| 1 | | Replying to [comment:9 westi]: |
| 2 | | > Replying to [comment:3 filosofo]: |
| 3 | | > > `handle-invalid-object-types.13958.diff` is my suggestion on how to handle this situation, both for missing post types and missing taxonomies: |
| 4 | | > > |
| 5 | | > > * If the menu item is associated with an invalid post or taxonomy type, the menu item: |
| 6 | | > > * Gets an error message for its title |
| 7 | | > > * Gets an empty URL |
| 8 | | > > * Receives the `post_status` property of "draft." |
| 9 | | > > * Front-end Walker displays only those menu items that have "publish" as their `post_status` property. |
| 10 | | > > * Edit menu Walker does not care whether menu items have "publish" as their `post_status` property. |
| 11 | | > > * 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. |
| 12 | | > > * Note that the added error message 'Invalid post type.' is not a new string. |
| 13 | | > |
| 14 | | > I am cool will all of this apart from: |
| 15 | | > |
| 16 | | > Replying to [comment:3 filosofo]: |
| 17 | | > > * 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. |
| 18 | | > |
| 19 | | > I would rather than they stayed as draft and were visible on the backend with some message. |
| 20 | | > |
| 21 | | > I would like us to have a sane behaviour if someone disables a plugin/theme to test something and then goes back. |
| 22 | | > |
| 23 | | > Don't want all the menu items that would be affected to disappear in that use-case. |
| 24 | | |