0

I have searched the internet and have also found some questions here with similar problems, but mine seems to be different.

I have created a custom post type, and neither can I see the "Draft" and "Trashed"-links in the admin panel's post type overview, nor are they counted: it says "All (0)", but there are some, and I have also put some posts in "draft"-status and deleted some others to fill the trash.

When I copy the URL from the "post" post type and replace it by my custom post type like this:

http://www.example.com/wp-admin/edit.php?post_status=draft&post_type=[mycustomposttype]

...I can see the posts in draft status; this also works with trash.

It would be great if anyone could point me in the right direction; this is my code to register the post type:

$args = array(
'label' => __('My Name', 'my-textdomain'),
'labels' => $labels,
'supports' => array(
    'title',
    'author',
    'editor',
    'custom-fields',
    'revisions'
),
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 66,
'menu_icon' => 'dashicons-awards',
'show_in_admin_bar' => false,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'post'
);

register_post_type('mycustomposttype', $args);

$labels keeps the default WP label set.

  • 1
    Did you test this on a vanilla install? – birgire Feb 1 '16 at 10:19
  • I tested it now in a vanilla WP 4.4.1 and my code works. I will proceed to find the error in the other environment and self-answer my question if I find it. Thanks for the hint. – simonthesorcerer Feb 1 '16 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.