latest version

Multi-Select

Select multiple choices from different sources: posts, taxonomies, users or a custom array.

array(
    'type'  => 'multi-select',
    'value' => array( 'choice-1', 'choice-3' ),
    'attr'  => array( 'class' => 'custom-class', 'data-foo' => 'bar' ),
    'label' => __('Label', '{domain}'),
    'desc'  => __('Description', '{domain}'),
    'help'  => __('Help tip', '{domain}'),
    /**
     * Set population method
     * Are available: 'posts', 'taxonomy', 'users', 'array'
     */
    'population' => 'array',
    /**
     * Set post types, taxonomies, user roles to search for
     *
     * 'population' => 'posts'
     * 'source' => 'page',
     *
     * 'population' => 'taxonomy'
     * 'source' => 'category',
     *
     * 'population' => 'users'
     * 'source' => array( 'editor', 'subscriber', 'author' ),
     *
     * 'population' => 'array'
     * 'source' => '' // will populate with 'choices' array
     */
    'source' => '',
    /**
     * Set the number of posts/users/taxonomies that multi-select will be prepopulated
     * Or set the value to false in order to disable this functionality.
     */
    'prepopulate' => 10,
    /**
     * An array with the available choices
     * Used only when 'population' => 'array'
     */
    'choices' => array(
        'choice-1' => __('Choice 1', '{domain}'),
        'choice-2' => __('Choice 2', '{domain}'),
        'choice-3' => __('Choice 3', '{domain}'),
    ),
    /**
     * Set maximum items number that can be selected
     */
    'limit' => 100,
)

Visual Composer Integration

Tip

This is a Bumblebee feature.

When converting ‘multi-upload’ option type to VC ‘autocomplete’ param, the following settings are set by default:

vc_map( array(
    'type'        => 'autocomplete',
    'param_name'  => ...
    'description' => ...
    'class'       => ...
    'group'       => ...
    'dependency'  => ...
    'heading'     => ...
    'settings'    => array( // can be overwritten by $options['settings']
        'groups'         => false, // not compatible with multi-select
        'multiple'       => true,  // can be changed by 'limit' option == 1
        'min_length'     => 1,
        'unique_values'  => true,
        'display_inline' => true,
        'delay'          => 500,
        'auto_focus'     => true,
    ),
);

‘settings’ array can be changed by passing ‘settings’ array in the option, eg.:

'pages'  => array(
    'type'       => 'multi-select',
    'label'      => esc_html__( "Select pages", 'ct_theme' ),
    'tab'        => esc_html__( "Pages", 'ct_theme' ),
    'limit'      => 1,
    'population' => 'posts',
    'source'     => 'page',
    'settings' => array(
        'groups'         => false, // not compatible with multi-select
        'multiple'       => false,
        'min_length'     => 3,
        'unique_values'  => false,
        'display_inline' => false,
        'delay'          => 3000,
        'auto_focus'     => false,
    ),
),

Read more about ‘autocomplete’ param at github