Opened 9 years ago
Closed 9 years ago
#33665 closed enhancement (fixed)
Menu Customizer: Implement indicators for invalid menu items
Reported by: | pavelevap | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
I sometimes found some mistake when menu contained obsolete items (for example not used post type, etc). Standard admin menu page shows notice (as soon as user visits this page) that something is wrong and all related items are red. But in Customizer it does not work?
Attachments (3)
Change History (19)
#1
@
9 years ago
- Milestone changed from Awaiting Review to 4.4
- Summary changed from Menu Customizer: Warning for obsolete items? to Menu Customizer: Implement indicators for invalid menu items
- Type changed from defect (bug) to enhancement
#4
follow-up:
↓ 5
@
9 years ago
Greta. And one more inconsistency: I can add draft items to menu (admin page), but it is not possible in Customizer.
#5
in reply to:
↑ 4
@
9 years ago
Replying to pavelevap:
Greta. And one more inconsistency: I can add draft items to menu (admin page), but it is not possible in Customizer.
That's for a separate ticket. ;)
#8
@
9 years ago
See also PR for attached patch: https://github.com/xwp/wordpress-develop/pull/119
This ticket was mentioned in Slack in #core by sergey. View the logs.
9 years ago
#14
@
9 years ago
Looks good to me, great work!
It seems to me that opening panel with menu is a little bit slower then before applying patch, but I did not have the time to test it better (and menu is large, more than 50 items)...
#15
@
9 years ago
- Keywords commit added; needs-testing needs-unit-tests removed
33665.2.diff ensures that _invalid
is always set and it is sanitized, and also adds unit tests.
Yes, this is something that was left as a todo in the implementation of Menus in the Customizer for 4.3, as can be seen here: https://core.trac.wordpress.org/browser/tags/4.3/src/wp-includes/class-wp-customize-setting.php#L687
The
wp_setup_nav_menu_item()
function sets an_invalid
property if the object that the item refers to is gone (i.e. obsolete). So this needs to be exposed as a read-only property of thenav_menu_item
setting, probably in WP_Customize_Nav_Menu_Item_Setting::value()