Make WordPress Core


Ignore:
Timestamp:
05/14/2010 02:13:49 AM (15 years ago)
Author:
nbachiyski
Message:

Keep label as a quick way to set up a taxonomy/post type, without diving into the labels array. Deprecate singular_label while there. Props nacin. Fixes #13357

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r14614 r14619  
    772772 * Optional $args contents:
    773773 *
     774 * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used.
    774775 * - description - A short descriptive summary of what the post type is. Defaults to blank.
    775776 * - public - Whether posts of this type should be shown in the admin UI. Defaults to false.
     
    870871
    871872    $args->labels = get_post_type_labels( $args );
    872    
    873     // we keep these two only for backwards compatibility
    874     // TODO: remove in 3.1 
    875873    $args->label = $args->labels->name;
    876     $args->singular_label = $args->labels->singular_name;
    877874
    878875    $wp_post_types[$post_type] = $args;
     
    921918 *
    922919 * Accepted keys of the label array in the post type object:
    923  * - name - general name for the post type, usually plural. Default is Posts/Pages
     920 * - name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages
    924921 * - singular_name - name for one object of this post type. Default is Post/Page
    925922 * - 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: <code>_x('Add New', 'product');</code>
     
    966963function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
    967964   
    968     // try to get missing (singular_)?name from older style (singular_)?label member variables
    969     // we keep that for backwards compatibility
    970     // TODO: remove in 3.1
    971     if ( !isset( $object->labels['name'] ) && isset( $object->label ) ) {
     965    if ( isset( $object->label ) ) {
    972966        $object->labels['name'] = $object->label;
    973     }
    974     if ( !isset( $object->labels['singular_name'] ) && isset( $object->singular_label ) ) {
    975         $object->labels['singular_name'] = $object->singular_label;
    976967    }
    977968   
Note: See TracChangeset for help on using the changeset viewer.