Nav Menus: Avoid a PHP Notice when a menu contains a now unregistered post type archive.

Props kucrut.
Fixes #34449 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@36095 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-12-26 04:04:55 +00:00
parent 1d2904bf2a
commit 0df95091ee
2 changed files with 6 additions and 2 deletions

View File

@ -80,7 +80,9 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
$original_title = get_the_title( $original_object->ID );
} elseif ( 'post_type_archive' == $item->type ) {
$original_object = get_post_type_object( $item->object );
$original_title = $original_object->labels->archives;
if ( $original_object ) {
$original_title = $original_object->labels->archives;
}
}
$classes = array(

View File

@ -417,7 +417,9 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
$original_title = $original_object->post_title;
} elseif ( 'post_type_archive' == $args['menu-item-type'] ) {
$original_object = get_post_type_object( $args['menu-item-object'] );
$original_title = $original_object->labels->archives;
if ( $original_object ) {
$original_title = $original_object->labels->archives;
}
}
if ( $args['menu-item-title'] == $original_title )