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
This commit is contained in:
Sergey Biryukov 2020-02-07 23:44:22 +00:00
parent dce15b92d0
commit 11eb80e59e

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;