Multi Site Search Pagination is Broken

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.

Read More

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

http://cgcookie.com/blender/blender/page/2/?s=blender

This is incorrect, and should be:

http://cgcookie.com/blender/page/2/?s=blender

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?

Related posts

Leave a Reply

2 comments

  1. 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 ) 
    

    to

    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.