Opened 3 years ago
Closed 2 years ago
#13994 closed defect (bug) (fixed)
Menu Item "Home" won't have class "current-menu-item" in case of there are query string in the home url
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Menus | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description (last modified by dd32)
Repro steps:
==========
- Add "Home" to the navigation menu
- Navigate to http://thetestsite/?style=stylename[[BR]]
- Check the css class of "Home" on the navigation menu
Expected:
==========
There is the class "current-menu-item"
Actual:
==========
There isn't the class "current-menu-item"
Desc:
==========
- It works when there are no query string in the url say: http://thetestsite/[[BR]]
- It is related to Changeset 14457
Attachments (2)
Change History (17)
Repro steps:
==========
- Add "Home" to the navigation menu
- Navigate to http://thetestsite/?style=stylename
- Check the css class of "Home" on the navigation menu
Expected:
==========
There is the class "current-menu-item"
Actual:
==========
There isn't the class "current-menu-item"
Description:
==========
- It works when there are no query string in the url say: http://thetestsite/
- It is related to Changeset 14457
How would you propose that WP go about determining which query strings make a significant-enough change to warrant saying the page is no longer the same? In this example presumably the only change has to do with the active stylesheet, but most query strings change the content.
I propose that any plugins or themes that use these strings take on the responsibility of handling the menu classes, as they're in the best (really--the only) position of being able to make that decision.
Query based on request url should have happened this time, can we use query results or relevant methods to handle this problem? is_home()?
The problem is not identifying the current query; it's matching it to the menu item's URL.
Menu item's URL: http://site.com/
Requested page: http://site.com/?foo=bar
How should WP know that the second is supposed to be equivalent to the first?
I think we are talking about the possibility of resolve this issue, right? Any reason we have to stick to the way by comparing url?
Have a try with is_home() on http://testsite/?que=ry, see true or false.
- Keywords has-patch added
- Milestone changed from 3.0.1 to 3.1
Thinking about this some more, I think this could be useful for matching the home URL when pages are involved, too.
Try front-page-current-class.13994.diff to see if that solves the problem for you.
comment:10
filosofo — 3 years ago
- Owner set to filosofo
- Status changed from new to accepted
comment:11
filosofo — 3 years ago
- Milestone changed from Awaiting Triage to 3.1
comment:12
filosofo — 3 years ago
Patch is still fresh.
comment:13
westi — 3 years ago
When is this code meant to trigger?
http://trunk.domain/?foo=bar which seems to be what the ticket is talking about doesn't trigger it.
comment:14
filosofo — 3 years ago
Apparently someone's been untrailingslashitting stuff in the last half year.
Patch refreshed.
comment:15
markjaquith — 2 years ago
- Resolution set to fixed
- Status changed from accepted to closed

Related #13977