Opened 18 months ago
Closed 18 months ago
#19699 closed defect (bug) (fixed)
current-menu-item and current_page_item classes incorrectly added to custom menu items with no URL value.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3.1 |
| Component: | Menus | Version: | 3.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
If the current page is the home page, the _wp_menu_item_classes_by_context function will incorrectly add the current-menu-item and current_page_item classes to any custom menu items that do not have a value for URL. This occurs because the custom menu item URL (after formatting) compares equal to the home page URL.
Note - a custom menu item might not have a URL value if it is used as only a parent container for another submenu.
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Caused by [18746] for #15954 because $_root_relative_current is an empty string for the home page. We could check if the URL is empty for custom menu items before adding classes.