Introduction
The post_select type field, part of the Settings API, allows the user to select a post object from a drop down. To ensure performance, only a set number of posts populate the select field and other posts are dynamically populated as the user performs a search.
Example
This field will output a select field containing posts of the specified post types.
array(
'title' => 'Post Select Field',
'fields' => array(
array(
'type' => 'post_select',
'name' => 'mypostselect',
'label' => esc_html__( 'This is my post object selection.', 'sometextdomain' ),
'post_type' => 'group'
),
)
)
The code above will render the select field similar to the following. When given focus and text is entered to the “Search all…” input, then additional choices are queried and populate to the select field.
Filters
The filter gform_post_select_initial_count
can be used to set the initial number of posts returned.
The filter gform_post_select_post_types
can be used to set the post types available for use in this field type.
Since
Added in Gravity Forms version 2.6.4