WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17175 closed defect (bug) (duplicate)

Custom Menus: handling items who's CPT doesn't exist anymore

Reported by: scribu Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Menus Keywords:
Focuses: Cc:

Description

Steps to reproduce:

  1. Register a custom post type
  2. Create a post with that type
  3. Add that post to a custom menu
  4. Unregister the custom post type

You will get a notice:

Notice: Trying to get property of non-object in /home/cristi/svn/wp/wp-includes/nav-menu.php on line 565

which is here:

$object = get_post_type_object( $menu_item->object );

$menu_item->type_label = $object->labels->singular_name;

The $object variable will be null in this case.

Change History (2)

comment:1 dd323 years ago

There must be a duplicate ticket of this.. I cant find it as usual, but I've seen it reported many times..

comment:2 duck_3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.