Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33665 closed enhancement (fixed)

Menu Customizer: Implement indicators for invalid menu items

Reported by: pavelevap's profile pavelevap Owned by: westonruter's profile westonruter
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch commit
Focuses: Cc:


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)

33665.diff (3.3 KB) - added by kucrut 9 years ago.
Implement indicators for invalid menu items
Menu_Customizer_invalid_items.png (127.2 KB) - added by pavelevap 9 years ago.
33665.2.diff (6.1 KB) - added by westonruter 9 years ago.
Additional change:

Download all attachments as: .zip

Change History (19)

#1 @westonruter
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

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:

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 the nav_menu_item setting, probably in WP_Customize_Nav_Menu_Item_Setting::value()

#2 @westonruter
9 years ago

  • Keywords needs-patch added
  • Version changed from trunk to 4.3

#3 @westonruter
9 years ago

  • Component changed from Menus to Customize

#4 follow-up: @pavelevap
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 @atomicjack
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. ;)

9 years ago

Implement indicators for invalid menu items

#7 @kucrut
9 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#8 @westonruter
9 years ago

Last edited 9 years ago by westonruter (previous) (diff)

#9 @westonruter
9 years ago

  • Keywords needs-unit-tests added

This ticket was mentioned in Slack in #core by sergey. View the logs.

9 years ago

#11 @SergeyBiryukov
9 years ago

  • Owner set to westonruter
  • Status changed from new to assigned

#12 @DrewAPicture
9 years ago

@westonruter How's this looking? Looks like maybe we still need unit tests?

#13 @westonruter
9 years ago

@pavelevap Can you test the patch and confirm it resolves the issue you reported?

#14 @pavelevap
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 @westonruter
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.

#16 @westonruter
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 35302:

Customizer: Implement indicators for invalid nav menu items.

The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator.

Props kucrut, westonruter.
Fixes #33665.

Note: See TracTickets for help on using tickets.