WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/08/2016 06:24:50 PM (6 years ago)
Author:
DrewAPicture
Message:

Menus: Avoid a notice when outputting a description for an existing archive menu item for a post type that doesn't.

Props bradyvercher.
See [36859]. Fixes #35324.

File:
1 edited

Legend:

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

    r36859 r36888  
    763763                if ( $object ) {
    764764                    $menu_item->title = '' == $menu_item->post_title ? $object->labels->archives : $menu_item->post_title;
     765                    $post_type_description = $object->description;
    765766                } else {
    766767                    $menu_item->_invalid = true;
     768                    $post_type_description = '';
    767769                }
    768770
    769771                $menu_item->type_label = __( 'Post Type Archive' );
    770772                $post_content = wp_trim_words( $menu_item->post_content, 200 );
    771                 $post_type_description = '' == $post_content ? $object->description : $post_content;
     773                $post_type_description = '' == $post_content ? $post_type_description : $post_content;
    772774                $menu_item->url = get_post_type_archive_link( $menu_item->object );
    773775            } elseif ( 'taxonomy' == $menu_item->type ) {
Note: See TracChangeset for help on using the changeset viewer.