From b70056dd7093ec24d6e711bd7d3803c830c3a4f5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 7 Feb 2020 23:46:05 +0000 Subject: [PATCH] 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 --- wp-includes/nav-menu.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index e871578213..b6dbf73131 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index bac12d152e..18ffab1250 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.