Make WordPress Core


Ignore:
Timestamp:
07/26/2020 01:12:51 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Make get_post_states() available on frontend.

This allows special pages to be denoted as such when editing a menu in the Customizer.

This applies to the Front Page, Posts Page, and Privacy Policy Page.

Follow-up to [47211], [47213], [47763].

Props dlh, whyisjake, SergeyBiryukov.
Fixes #46829. See #49374.

File:
1 edited

Legend:

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

    r48439 r48619  
    817817                if ( $object ) {
    818818                    $menu_item->type_label = $object->labels->singular_name;
    819                     // Use post states for special pages (only in the admin).
    820                     if ( function_exists( 'get_post_states' ) ) {
    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 = wp_strip_all_tags( implode( ', ', $post_states ) );
    825                         }
     819                    // Use post states for special pages.
     820                    $menu_post   = get_post( $menu_item->object_id );
     821                    $post_states = get_post_states( $menu_post );
     822                    if ( $post_states ) {
     823                        $menu_item->type_label = wp_strip_all_tags( implode( ', ', $post_states ) );
    826824                    }
    827825                } else {
Note: See TracChangeset for help on using the changeset viewer.