diff --git a/wp-includes/post.php b/wp-includes/post.php index f17f98f301..d58631ca02 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -771,6 +771,7 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) * * Optional $args contents: * + * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used. * - description - A short descriptive summary of what the post type is. Defaults to blank. * - public - Whether posts of this type should be shown in the admin UI. Defaults to false. * - exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public. @@ -869,11 +870,7 @@ function register_post_type($post_type, $args = array()) { add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1); $args->labels = get_post_type_labels( $args ); - - // we keep these two only for backwards compatibility - // TODO: remove in 3.1 $args->label = $args->labels->name; - $args->singular_label = $args->labels->singular_name; $wp_post_types[$post_type] = $args; @@ -920,7 +917,7 @@ function get_post_type_capabilities( $args ) { * Builds an object with all post type labels out of a post type object * * Accepted keys of the label array in the post type object: - * - name - general name for the post type, usually plural. Default is Posts/Pages + * - name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages * - singular_name - name for one object of this post type. Default is Post/Page * - add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example: _x('Add New', 'product'); * - add_new_item - Default is Add New Post/Add New Page @@ -965,15 +962,9 @@ function get_post_type_labels( $post_type_object ) { */ function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { - // try to get missing (singular_)?name from older style (singular_)?label member variables - // we keep that for backwards compatibility - // TODO: remove in 3.1 - if ( !isset( $object->labels['name'] ) && isset( $object->label ) ) { + if ( isset( $object->label ) ) { $object->labels['name'] = $object->label; } - if ( !isset( $object->labels['singular_name'] ) && isset( $object->singular_label ) ) { - $object->labels['singular_name'] = $object->singular_label; - } if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) { $object->labels['singular_name'] = $object->labels['name']; diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 5473ebbfd9..b61cad10e2 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -210,6 +210,8 @@ function is_taxonomy_hierarchical($taxonomy) { * whether taxonomy exists. * * Optional $args contents: + * + * label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used. * * hierarchical - has some defined purpose at other parts of the API and is a * boolean value. @@ -297,12 +299,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { $args['name'] = $taxonomy; $args['object_type'] = (array) $object_type; + $args['labels'] = get_taxonomy_labels( (object) $args ); - - // we keep these two only for backwards compatibility - // TODO: remove in 3.1 $args['label'] = $args['labels']->name; - $args['singular_label'] = $args['labels']->singular_name; $wp_taxonomies[$taxonomy] = (object) $args; @@ -314,7 +313,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { * Builds an object with all taxonomy labels out of a taxonomy object * * Accepted keys of the label array in the taxonomy object: - * - name - general name for the taxonomy, usually plural. Default is Post Tags/Categories + * - name - general name for the taxonomy, usually plural. The same as and overriden by $tax->label. Default is Post Tags/Categories * - singular_name - name for one object of this taxonomy. Default is Post Tag/Category * - search_items - Default is Search Tags/Search Categories * - popular_items - Default is Popular Tags/Popular Categories