• Resolved ricflomag2

    (@ricflomag2)


    Hi there,

    Strange behavior of the search results pagination : say I have 87 results.
    – The first page shows the first 25 results, as expected.
    – But the second page shows results 51 to 75 instead of 26 to 50.
    – There is a pagination link to show page 3, but it yields a 404 error (trying to show results 101 to 125).

    I have a dirty workaround : comment out lines 1693 to 1696 of the file search.php in Relevanssi (done right now, so my site behaves ok).

    	/*if ( isset( $query->query_vars['offset'] ) && $query->query_vars['offset'] > 0 ) {
    		$search_high_boundary += $query->query_vars['offset'];
    		$search_low_boundary  += $query->query_vars['offset'];
    	}*/

    Where should I investigate to find a good solution ? I use a slightly customized Hueman theme, and I don’t see any query_posts() or $wp_query->get_posts().

    Cheers,
    Franck.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    That’s weird, because your site seems to be using the regular paging, and that shouldn’t use the offset parameter at all, so commenting out those lines should not actually do anything.

    However, if you have the standard paging and on top of that set the offset for some reason, that’s going to break the paging –?it actually says so in the WP_Query Codex documentation, so if Relevanssi does that too, Relevanssi is just behaving as expected =D

    Add this to your theme functions.php and see what it prints out:

    add_filter( 'relevanssi_modify_wp_query', 'rlv_check_parameters' );
    function rlv_check_parameters( $query ) {
        var_dump( $query->query_vars );
        exit();
    }

    Is the offset parameter perhaps set?

    Thread Starter ricflomag2

    (@ricflomag2)

    Hi Mikko ! Thanks for your kind support.

    Well yes, it seems to be set :

    ["offset"]=>
      int(25)

    Maybe I should investigate if some other plugin interferes with the pagination ? I can do that tomorrow ??

    Regards.

    Plugin Author Mikko Saari

    (@msaari)

    Yeah, it’s best if you can figure out what sets that. If you can’t find it out, you can always reset it:

    add_filter( 'relevanssi_modify_wp_query', 'rlv_reset_offset' );
    function rlv_reset_offset( $query ) {
        $query->set( 'offset', 0 );
        return $query;
    }
    Thread Starter ricflomag2

    (@ricflomag2)

    Found ! Custom Posts Per Page, an unmaintained extension (https://fr.www.ads-software.com/plugins/custom-posts-per-page/), seems to be responsible. I have disabled it and the pagination behaves as expected now.

    Thanks again Mikko,
    Franck.

    Plugin Author Mikko Saari

    (@msaari)

    Glad to hear you found it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘One page out of two in search results’ is closed to new replies.