#27549 closed defect (bug) (duplicate)
register_post_type arguments producing unexpected output
Reported by: | stuartwider | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
When setting up a custom post type with register_post_type() which includes the following arguments the custom post type will show regular posts instead of the custom post type. The arguments that seem to be causing the problem are:
'public' => false, 'publicly_queryable' => false,
I created the following plugin code to demonstrate the issue:
<?php /* Plugin Name: Broken Custom Posts Types Demo */ add_action( 'init', 'this_post_type_works' ); function this_post_type_works() { register_post_type( 'super_duper', array( 'labels' => array( 'name' => __( 'Super Duper' ), 'singular_name' => __( 'Super Duper' ) ), 'public' => true, 'show_ui' => true, ) ); } add_action( 'init', 'this_post_type_does_not_work' ); function this_post_type_does_not_work() { register_post_type( 'not_super', array( 'labels' => array( 'name' => __( 'Not Super' ), 'singular_name' => __( 'Not Super' ) ), 'public' => false, 'show_ui' => true, 'publicly_queryable' => false, ) ); } ?>
You should see that when your are in the WordPress Admin and you click on the 'Not Super' custom post type that regular posts are being returned instead of the 'Not Super' post type.
Change History (4)
Note: See
TracTickets for help on using
tickets.
Btw I'm testing on 3.9-beta2-27714, newly created site with no plugins active, default 2014 theme, on my test WP multisite setup.