[wp-trac] [WordPress Trac] #27549: register_post_type arguments producing unexpected output

WordPress Trac noreply at wordpress.org
Thu Mar 27 12:06:34 UTC 2014


#27549: register_post_type arguments producing unexpected output
--------------------------+-----------------------------
 Reporter:  stuartwider   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27549>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list