Forums Forums Search & Filter Pro Search and Filter Pro breaking site search pagination

Viewing 8 posts - 11 through 18 (of 18 total)
  • Anonymous
    #41713
    This reply has been marked as private.
    Ross Moderator
    #41743
    This reply has been marked as private.
    Ross Moderator
    #41865
    This reply has been marked as private.
    Anonymous
    #41868
    This reply has been marked as private.
    Ross Moderator
    #41984
    This reply has been marked as private.
    Anonymous
    #41986
    This reply has been marked as private.
    Ross Moderator
    #41987

    Hey John

    I managed to figure out the issue… its wasn’t easy but I used your theme locally at first…

    Your theme by default adds pages to your search results (as opposed to just posts)…

    And this highlighted the issue…

    Its because your search results contain the S&F page with the results shortcode – that the pagination functions kick in and take over your normal pagination.. its wierd to say the least because I thought shortcodes inside pages were not executed when you use the_excerpt() in your template.. turns out somehow they still are :/

    Anyway, the quick fix is to exclude this page from your normal search results – I tested this in functions.php of theme you gave me and it worked (replace 12767 with the ID of your page holding the search results):

    function remove_id_from_search($query) {
    	if ( !$query->is_admin && $query->is_search) {
    		$query->set('post__not_in', array(12767) ); // id of page or post
    	}
    	return $query;
    }
    add_filter( 'pre_get_posts', 'remove_id_from_search' );

    Now to find out how I can prevent this in the future :@

    Thanks

    Anonymous
    #42089
    This reply has been marked as private.
Viewing 8 posts - 11 through 18 (of 18 total)