Menus: Use `get_post_states()` to denote special pages on the added menu item accordions.

Front Page, Posts Page, or Privacy Policy Page should now be marked as such on the added menu items.

Props garrett-eclipse.
Fixes #49374.
Built from https://develop.svn.wordpress.org/trunk@47211


git-svn-id: http://core.svn.wordpress.org/trunk@47011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-07 23:46:05 +00:00
parent 803feb30dd
commit b70056dd70
2 changed files with 7 additions and 1 deletions

View File

@ -817,6 +817,12 @@ function wp_setup_nav_menu_item( $menu_item ) {
$object = get_post_type_object( $menu_item->object );
if ( $object ) {
$menu_item->type_label = $object->labels->singular_name;
// Use post states for special pages.
$menu_post = get_post( $menu_item->object_id );
$post_states = get_post_states( $menu_post );
if ( $post_states ) {
$menu_item->type_label = implode( ',', $post_states );
}
} else {
$menu_item->type_label = $menu_item->object;
$menu_item->_invalid = true;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47210';
$wp_version = '5.4-alpha-47211';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.