Make WordPress Core

Changeset 47211


Ignore:
Timestamp:
02/07/2020 11:44:22 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu.php

    r47157 r47211  
    818818                if ( $object ) {
    819819                    $menu_item->type_label = $object->labels->singular_name;
     820                    // Use post states for special pages.
     821                    $menu_post   = get_post( $menu_item->object_id );
     822                    $post_states = get_post_states( $menu_post );
     823                    if ( $post_states ) {
     824                        $menu_item->type_label = implode( ',', $post_states );
     825                    }
    820826                } else {
    821827                    $menu_item->type_label = $menu_item->object;
Note: See TracChangeset for help on using the changeset viewer.