Skip to content

Commit c165557

Browse files
committed
Introduce menu_name label for taxonomies and post types. Defaults to name. fixes #14832.
git-svn-id: https://develop.svn.wordpress.org/trunk@16251 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 07522b1 commit c165557

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

wp-admin/menu.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )
7171
continue;
7272

73-
$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
73+
$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
7474
}
7575
unset($tax);
7676

@@ -94,7 +94,7 @@
9494
if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )
9595
continue;
9696

97-
$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );
97+
$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );
9898
}
9999
unset($tax);
100100

@@ -125,16 +125,16 @@
125125
while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
126126
$ptype_menu_position++;
127127

128-
$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
129-
$submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
128+
$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
129+
$submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
130130
$submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" );
131131

132132
$i = 15;
133133
foreach ( $wp_taxonomies as $tax ) {
134134
if ( ! $tax->show_ui || ! in_array($ptype, (array) $tax->object_type, true) )
135135
continue;
136136

137-
$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
137+
$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );
138138
}
139139
}
140140
unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i);

wp-includes/post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,9 @@ function get_post_type_labels( $post_type_object ) {
11421142
'search_items' => array( __('Search Posts'), __('Search Pages') ),
11431143
'not_found' => array( __('No posts found.'), __('No pages found.') ),
11441144
'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
1145-
'parent_item_colon' => array( null, __('Parent Page:') )
1145+
'parent_item_colon' => array( null, __('Parent Page:') ),
11461146
);
1147+
$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
11471148
return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
11481149
}
11491150

wp-includes/taxonomy.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ function get_taxonomy_labels( $tax ) {
403403
'add_or_remove_items' => array( __( 'Add or remove tags' ), null ),
404404
'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ),
405405
);
406+
$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
406407

407408
return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
408409
}

0 commit comments

Comments
 (0)