From 11eb80e59e804ad14da7a2f85240d7b1b019226e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 7 Feb 2020 23:44:22 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@47211 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/nav-menu.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php index e871578213..b6dbf73131 100644 --- a/src/wp-includes/nav-menu.php +++ b/src/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;