Skip to main content

SelectMultiple

Multiple select dropdowns. Takes all props select accepts.

Consider using checkbox-multiple or select with multiple => true if you don't need to limit the number of options.

Returns an array of selected values.

Value

Returns (string|number)[]

$value = json_decode(fx_get_meta('id'), true);

Example

'id' => [
'type' => 'select',
'className' => 'my-class-name',
'creatable' => false,
'excludePostType' => false,
'multiple' => true,
'nOptions' => 4,
'options' => 'page, post',
'placeholder' => 'Pick some content',
],

Props

className

Metabox class name

type: string

creatable

Allow new options to be created

type: bool

defaultValue: false

exclude

A list of ids to exlude from the options list

type: array

excludePostType

Hide the post type if the option is a post

type: bool

defaultValue: false

multiple

Allow multiple selections

type: bool

defaultValue: false

nOptions

The number of dropdowns

type: number

defaultValue: 1

options (required)

Options to choose from. See options for more information.

type: array

placeholder

Placeholder text for the input

type: string

defaultValue: 'Please select...'

title

Metabox title

type: string