Multiple Post Types for field type: select_advanced

Support General Multiple Post Types for field type: select_advancedResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20430
    Michael SorianoMichael Soriano
    Participant

    I want to allow multiple post types to select_advanced field. I have a post type named "plot", but I also want to add another post type in the autosuggest.

    See commented below.

    array(
                        'name'        => esc_html__( 'Plot', self::$namespace ),
                        'id'          => self::$pin . '_plot_id',
                        'type'        => 'post',
                        'label_description' => esc_html__( 'Start typing', self::$namespace ),
                        'post_type'   => 'plot',  <-----I WANT TO ALLOW MULTIPLE POST TYPES HERE---->
                        'field_type'  => 'select_advanced',                   
                        'query_args'  => array(
                            'post_status'    => 'publish',
                            'posts_per_page' => -1,
                        )
                    )

    I couldn't find it in the docs. Is this possible?

    Or can I achieve this using another field type?

    #20433
    Long NguyenLong Nguyen
    Moderator

    Hi,

    To show multiple post types, you can use an array of post types.

    'post_type' => array( 'post', 'page', 'plot' )

    We've written about this setting in the documentation

    post_type Post type. Can be string (for single post type) or array (for multiple post types). Required.

    You can also select multiple post types with MB Builder, see my screenshot https://share.getcloudapp.com/DOuAoPqY.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.