Opened 23 months ago
Closed 11 months ago
#18034 closed defect (bug) (fixed)
Incorrect URL for second page of search results
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Multisite | Version: | 3.2 |
| Severity: | normal | Keywords: | has-patch needs-testing needs-unit-tests |
| Cc: |
Description
I enter the Search Term (uptime) into search box in Adminbar
First page of results shows up fine at :-
https://domain.tld/blogname?s=uptime
Link to second page of search results shows blogname repeated :-
https://domain.tld/blogname/blogname/page/2/?s=uptime
If I edit the URL manually and visit :-
https://domain.tld/blogname/page/2/?s=uptime
it works fine.
Link to the third page of search results shows fine too :-
https://domain.tld/blogname/page/3/?s=uptime
Also fourth and fifth pages are OK.
Regular page links are fine :-
https://domain.tld/blogname/page/2/
I have tested on three different blogs hosted on this multisite.
Changed themes (P2 and Twenty Eleven), same results.
Tested with Firefox and Chrome browsers.
Attachments (4)
Change History (19)
comment:1
SergeyBiryukov — 20 months ago
- Keywords reporter-feedback added; search removed
comment:2
mark.waters — 20 months ago
All the blogs are set to - "Day and name" permalink structure.
I can reproduce this on my site as well.
Permalinks set to /post-id/postname. Was able to repro with ugly permalinks as well. All page twos double up the blogname.
See http://wordpress.org/support/topic/multi-site-admin-bar-search-returning-bad-urls
ETA: This only happens with admin-bar searching. Normal widget caused search is fine.
comment:4
mark.waters — 20 months ago
Can confirm it only affects Adminbar search , added search Widget to sidebar and this works as expected.
Somewhat reassuring that its happening to others , thanks Ipstenu.
SergeyBiryukov — 20 months ago
comment:5
follow-up:
↓ 7
SergeyBiryukov — 20 months ago
- Component changed from General to Multisite
- Keywords has-patch added; reporter-feedback removed
- Milestone changed from Awaiting Review to 3.3
Ah, I was only checking a single site install.
This is a combination of several issues:
- Unlike get_search_form(), admin bar misses a slash when calling home_url():
Should be: https://domain.tld/blogname/?s=test
Actual: https://domain.tld/blogname?s=test - For some reason, canonical redirect from ?s=test to /?s=test only happens on the main site.
- get_pagenum_link() then fails to properly replace $home_root in $request:
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/link-template.php#L1487
18034.patch fixes the first issue. Doesn't touch canonical redirect or get_pagenum_link().
SergeyBiryukov — 20 months ago
SergeyBiryukov — 20 months ago
Tested on 3.3-beta and it works perfectly. While not a complete fix, putting this in 3.3 will restore functionality.
comment:7
in reply to:
↑ 5
SergeyBiryukov — 20 months ago
Replying to SergeyBiryukov:
- For some reason, canonical redirect from ?s=test to /?s=test only happens on the main site.
Turned out there's no canonical redirect on the main site too. The slash is added by browser (on a sub-domain install) or Apache (on a sub-directory install with WP in a non-root directory).
18034.2.patch is an attempt to consistently perform a redirect for all sites in the network.
18034.3.patch also fixes the third issue. Looks like we don't need trailingslashit() here, as the slash is then removed by the second preg_replace().
- Keywords needs-testing needs-unit-tests 3.4-early added
- Milestone changed from 3.3 to Future Release
Anything that touches redirects should have unit test, right? Not a regression or a new problem, moving to 3.4.
comment:9
SergeyBiryukov — 18 months ago
18034.patch solves the reported issue without touching redirects.
comment:10
nacin — 18 months ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In [19405]:
comment:11
nacin — 18 months ago
In [19406]:
comment:12
nacin — 18 months ago
- Resolution fixed deleted
- Status changed from closed to reopened
Re-opening for 3.4, but, there are almost positively other tickets that address all other issues here already. If someone can find them, please re-close this as fixed on 3.3.
Related: #14011
SergeyBiryukov — 11 months ago
- Keywords 3.4-early removed
- Milestone changed from Future Release to 3.5
comment:15
markjaquith — 11 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In [21174]:

Can't reproduce this.
https://domain.tld/blogname?s=uptime is redirected to https://domain.tld/blogname/?s=uptime (with slash), and the link to the second page is https://domain.tld/blogname/page/2/?s=uptime.
What's your permalink structure?