[wp-trac] [WordPress Trac] #17175: Custom Menus: handling items who's CPT doesn't exist anymore

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 19 09:30:23 UTC 2011


#17175: Custom Menus: handling items who's CPT doesn't exist anymore
--------------------------+-----------------------------
 Reporter:  scribu        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:
 Severity:  minor         |   Keywords:
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17175>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list