WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the CG Cookie network is running a WordPress multi site install. There is a strange bug happening with the search pagination when on any of the sub sites.

For example, if you go to http://cgcookie.com/blender/, which is one of the sub sites, and do a search for "blender", you will be taken to a search results page with about 389 items. The first page displays perfectly fine, but if you try to click over to page 2, or any of the other pages, you will be directed to a random tutorial post.

Upon closer investigation, you will notice that the url of the page numbers is of the following structure:


This is incorrect, and should be:


So, for some reason, the site name is getting inserted into the search URL twice. If I manually remove one of the site names, and enter the correct url, everything works fine. Why is it putting two site names in the url?

It's important to note that this bug ONLY happens on the search results pagination (not on any of the archives) and it also ONLY happens when on a sub site. If you search for "blender" from the http://cgcookie.com domain, it works perfectly fine.

For the pagination, I am using the function that Kriesi wrote here. Note, however, that I do not believe it is a problem with the function, as the WP Page Numbers plugin had the exact same problem.

I ran into this problem once before, and you can see my question about it here. The fixes described there have made no difference.

Anyone have any ideas?

share|improve this question
up vote 0 down vote accepted

This issue has been raised as a Core Trac Ticket here: http://core.trac.wordpress.org/ticket/18034

Seems to be the same as this issue: Multisite Admin Bar Search Pagination

share|improve this answer
Ah, excellent. I was able to find a work around but it was messy. Glad to see it's getting fixed. – Pippin Oct 15 '11 at 17:29

Core Track Ticket fixed it, but for quick reference, change wp-includes/canonical.php, line 40, from

if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || $is_IIS ) 


if ( is_trackback() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || $is_IIS ) 

There are other edits in the track ticket as well.

share|improve this answer
No. Never change core files. – Pippin May 23 '12 at 2:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.