Make WordPress Core

Opened 11 years ago

Last modified 7 years ago

#35702 new enhancement

No current-menu-item in WP custom menus

Reported by: dotancohen Owned by:
Priority: normal Milestone:
Component: Menus Version:
Severity: normal Keywords: needs-refresh
Cc: Focuses: ui, template

Description

The _wp_menu_item_classes_by_context() method misses some menu item matches for the currently-queried object. This patch adds support for a common case.

Attachments (2)

wp_35702.diff​ (933 bytes ) - added by dotancohen 11 years ago.
Diff file which resolves the issue for a common use case.
wp_35702.2.diff​ (986 bytes ) - added by dotancohen 11 years ago.
Better diff, doesn't break other pages!

Download all attachments as: .zip

Change History (5)

@dotancohen
11 years ago

Diff file which resolves the issue for a common use case.

#1 @dotancohen
11 years ago

My test case is for the taxonomy archive "מוצרים", where the custom menu was set "/מוצרים" and "/מוצרים/", both of which are valid links but neither of which was matched by the pre-patch WP trunk. With the patch both cases are matched properly.

@dotancohen
11 years ago

Better diff, doesn't break other pages!

#2 @obenland
11 years ago

  • Type defect (bug) → enhancement
  • Version trunk

#3 @welcher
10 years ago

  • Keywords needs-refresh added

@dotancohen - Thanks for the patch!

It just needs some clean up to match coding standards for whitespace. ​https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#space-usage

After that, let's get some unit tests in place.

Note: See TracTickets for help on using tickets.