[wp-trac] [WordPress Trac] #13958: Deactivating custom post types/taxonomies breaks nav menus

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 23 14:36:50 UTC 2010


#13958: Deactivating custom post types/taxonomies breaks nav menus
--------------------------+-------------------------------------------------
 Reporter:  WraithKenny   |       Owner:  filosofo             
     Type:  defect (bug)  |      Status:  accepted             
 Priority:  normal        |   Milestone:  3.0.1                
Component:  Menus         |     Version:  3.0                  
 Severity:  normal        |    Keywords:  2nd-opinion has-patch
--------------------------+-------------------------------------------------

Comment(by jaredwilli):

 Replying to [comment:9 westi]:
 > Replying to [comment:3 filosofo]:
 > > `handle-invalid-object-types.13958.diff` is my suggestion on how to
 handle this situation, both for missing post types and missing taxonomies:
 > >
 > >  * If the menu item is associated with an invalid post or taxonomy
 type, the menu item:
 > >    * Gets an error message for its title
 > >    * Gets an empty URL
 > >    * Receives the `post_status` property of "draft."
 > >  * Front-end Walker displays only those menu items that have "publish"
 as their `post_status` property.
 > >  * Edit menu Walker does not care whether menu items have "publish" as
 their `post_status` property.
 > >  * Upon saving a menu item that is associated with an invalid post or
 taxonomy type, `wp_update_nav_menu_item` returns an error object,
 effectively deleting the menu item on save.
 > >  * Note that the added error message 'Invalid post type.' is not a new
 string.
 >
 > I am cool will all of this apart from:
 >
 > Replying to [comment:3 filosofo]:
 > >  * Upon saving a menu item that is associated with an invalid post or
 taxonomy type, `wp_update_nav_menu_item` returns an error object,
 effectively deleting the menu item on save.
 >
 > I would rather than they stayed as draft and were visible on the backend
 with some message.
 >
 > I would like us to have a sane behaviour if someone disables a
 plugin/theme to test something and then goes back.
 >
 > Don't want all the menu items that would be affected to disappear in
 that use-case.

 That's exactly what I was trying to do when I ran into this problem.

 The way I was thinking of with this is. Check if a post type or taxonomy
 exists, and if the terms being used are associated with an active and
 existing type or tax. Then use them as normal. But if no post type/tax
 used by terms is active or exists default display message no existing
 item, and remove them from the options.

 I'm not sure if this sort of thinking is as easily said since I'm not too
 familiar with Walker and understand there's much more to be considered
 probably too.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13958#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list