[wp-trac] [WordPress Trac] #35842: Register Post Type function label default

WordPress Trac noreply at wordpress.org
Tue Feb 16 10:14:44 UTC 2016


#35842: Register Post Type function label default
-------------------------------+-----------------------------
 Reporter:  moshiezz           |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  4.4.2
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 When registering a Post type if the label or labels arguments are not set
 the label takes on a default of 'Posts' and not the Post type's name.

 It states in the documentation that the label takes on the name of the
 Post type passed in as the first argument.

 I believe the fix is as simple as updating the defaults variable in wp-
 includes/post.php on line 1017 with the label argument set to the
 post_type variable.

 {{{#!php
 <?php
         $defaults = array(
                 'label'                => $post_type,
                 'labels'               => array(),
                 'description'          => '',
                 'public'               => false,
                 'hierarchical'         => false,
                 'exclude_from_search'  => null,
                 'publicly_queryable'   => null,
                 'show_ui'              => null,
                 'show_in_menu'         => null,
                 'show_in_nav_menus'    => null,
                 'show_in_admin_bar'    => null,
                 'menu_position'        => null,
                 'menu_icon'            => null,
                 'capability_type'      => 'post',
                 'capabilities'         => array(),
                 'map_meta_cap'         => null,
                 'supports'             => array(),
                 'register_meta_box_cb' => null,
                 'taxonomies'           => array(),
                 'has_archive'          => false,
                 'rewrite'              => true,
                 'query_var'            => true,
                 'can_export'           => true,
                 'delete_with_user'     => null,
                 '_builtin'             => false,
                 '_edit_link'           => 'post.php?post=%d',
         );
 }}}

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


More information about the wp-trac mailing list