Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I'm having a weird issue that I've never seen.

I have a search.php set up like this:

 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
query_posts($query_string . '&paged=' . $paged); 

if ( have_posts() ) : while ( have_posts() ) : the_post();
    // post stuff
endwhile; else:

endif;

pagination();


If I use anything but the default permalink structure, it breaks the pagination and returns a 404 and the second page.

Ant ideas?

share|improve this question
    
Can you post a bit more context, please? What's in $query_string and where do you get it from? –  wyrfel Mar 4 '11 at 5:40
    
There is no other context. That is all of the necessary info for the search.php template. $query_string prevents query_posts from ignoring the search query. –  Pippin Mar 4 '11 at 6:47
    
Okay, just noticed something really strange. First of all, I'm pretty sure this is only an issue with 3.1 Second, if I hold my mouse over a pagination link (such as page 1, page 2, etc) the url is my-site.com/blogname/blogname/page/#. Notice how blogname is repeated twice? Now what is even weirder is that it only does this if the /page/ parameter is not already in the url, such as when I'm on the very first page. If I manually change the url to my-site.com/blogname/page/2, everything works fine. –  Pippin Mar 4 '11 at 7:49
    
Oh, and it all works perfectly fine when on archive or blog pages. –  Pippin Mar 4 '11 at 7:52
    
Alright, I've solved the problem. Turns out that you should never use action="<?php bloginfo('url');?>" for searchform.php. It will work perfectly fine in terms of search results, but it will break the pagination, when using 3.1. Instead, you should use <?php echo home_url();?> for the form action. –  Pippin Mar 4 '11 at 14:43

1 Answer 1

up vote 0 down vote accepted

Alright, I've solved the problem. Turns out that you should never use action="" for searchform.php. It will work perfectly fine in terms of search results, but it will break the pagination, when using 3.1. Instead, you should use for the form action.

share|improve this answer

Your Answer

 
discard

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.