[wp-trac] [WordPress Trac] #16724: Add current-menu-item to custom links that only contains path

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 2 20:53:39 UTC 2011


#16724: Add current-menu-item to custom links that only contains path
--------------------------+------------------------------
 Reporter:  chrisbliss18  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by chrisbliss18):

 If you are talking about having links to network locations such as
 `//host/path`, I'm not sure that needs to be a concern.

 This section of code and the `$item_url` variable being modified are only
 for determining the classes to attribute to the different menu elements.
 So, even if there is an off chance that such a link could be improperly
 gain the current-menu-item class, this will do nothing to affect
 functionality.

 I tested by adding a custom link with a URL of `//contact` (since I have a
 page at `/contact`). I then navigated to the contact page and found that
 the contact page menu item had the current-menu-item class as expected and
 that the `//contact` menu item did not have this class. This is because
 the `//contact` link is being changed to `http://domain/other-
 path//contact` which will not match `http://domain/other-path/contact`.

 Even if someone navigates to `http://domain/other-path//contact` manually,
 the redirect_canonical function takes care of redirecting to
 `http://domain/other-path/contact/` so that even this will fail to add the
 current-menu-item class to the `//contact` link.

 Is there some angle that I haven't account for that will still cause an
 issue?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16724#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list