CMB2 / cmb2-attached-posts

Custom field for CMB2 for attaching posts to a page.
GNU General Public License v2.0
135 stars 62 forks source link

My custom post types are not being queried on 1.2.6 #44

Closed jonathandarchy closed 1 year ago

jonathandarchy commented 7 years ago

Hello,

I've registered a custom post type and created a cmb2 attached posts field in my options page:

$cmb->add_field( array(
    'name'    => __( 'Projects', 'glp' ),
    'desc'    => __( 'Drag...', 'glp' ),
    'id'      => 'projects_en_arr',
    'type'    => 'custom_attached_posts',
    'options' => array(
        'show_thumbnails' => true, // Show thumbnails on the left
        'filter_boxes'    => true, // Show a text box for filtering the results
        'query_args'      => array(
            'post_type' => 'projects',
            'post_status' => 'publish',
            'posts_per_page' => -1
        ),
    ),
) );

These are the CPT args , (I'm using extended_cpts to register it) :

'public'             => true,
'publicly_queryable' => true,
'show_ui'            => true,
'show_in_menu'       => true,
'query_var'          => true,
'capability_type'    => 'post',
'has_archive'        => false,
'hierarchical'       => false,
'menu_position'      => 6,
'supports'           => array( 'title', 'author', 'thumbnail','editor' ),

This returns no results in the given metabox on the admin screen, however, if I change post type to 'page' or 'post' it works as expected. I've tried to register a fresh custom post type and that one did not work as well. Also tried on a different website and same results.

I downgraded to 1.2.4 , works well.

Thanks a lot.