Make WordPress Core

Ticket #47935: patch.diff

File patch.diff, 1.2 KB (added by kamrankhorsandi, 6 years ago)

patch

  • wp-includes/nav-menu.php

    diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
    index 9b6eeba..b54c3c8 100644
    a b function wp_setup_nav_menu_item( $menu_item ) { 
    817817                                $menu_item->url = get_permalink( $menu_item->object_id );
    818818
    819819                                $original_object = get_post( $menu_item->object_id );
    820                                 /** This filter is documented in wp-includes/post-template.php */
    821                                 $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID );
    822820
    823                                 if ( '' === $original_title ) {
    824                                         /* translators: %d: ID of a post */
    825                                         $original_title = sprintf( __( '#%d (no title)' ), $original_object->ID );
     821                                $original_title = '';
     822                                if( !empty( $original_object ) ) {
     823                                        /** This filter is documented in wp-includes/post-template.php */
     824                                        $original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID );
     825
     826                                        if ( '' === $original_title ) {
     827                                                /* translators: %d: ID of a post */
     828                                                $original_title = sprintf( __( '#%d (no title)' ), $original_object->ID );
     829                                        }
    826830                                }
    827831
    828832                                $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;