Support » Plugin: Better Search - Relevant search results for WordPress » Removing filter and pages in search results

  • Resolved dayin

    (@dayin)


    I have seamless integration turned on and I’ve noticed that the random posts widget that I use on the blog is being populated with the results from searches, matching it exactly. If the results of a search are Post A, Post B and Post C the random posts widget displays Post A, Post B and Post C. I’ve added

    remove_filter( 'posts_where' , 'bsearch_where_clause' );

    to the end of better-search.php and that seems to fix the problem. However by adding that line of code some searches now include pages in the results even though I have them excluded in settings.

    I’m using version 1.3.6 of Better Search.

    Any help would be appreciated.

    https://wordpress.org/plugins/better-search/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Ajay

    (@ajay)

    Instead of your code above, could you please try this on line 959 and line 979

    if ( $wp_query->is_search && $wp_query->is_main_query() && $bsearch_settings['seamless'] && !is_admin() ) {

    I added a new clause for is_main_query() which might work by only affecting the main search results.

    Thread Starter dayin

    (@dayin)

    Thanks for the reply Ajay. I changed both lines 959 and 979 but search results still effect the random posts widget. I’ve also installed a different random posts plugin but the results are the same. Random posts match search results.

    Plugin Author Ajay

    (@ajay)

    Which random posts plugins are you using?
    I’ll try to test them on my installations and see what happens.

    Thread Starter dayin

    (@dayin)

    Appreciate all your help Ajay. At the moment I’m using Random Posts with Thumbnails and I’ve also installed Flexible Posts Widget.

    Plugin Author Ajay

    (@ajay)

    Thanks. Please give me a few days to look at this and see if I can find a solution to the same.

    Thread Starter dayin

    (@dayin)

    Thanks Ajay.

    Plugin Author Ajay

    (@ajay)

    Hi,

    I tried using Random Posts with Thumbnails and seems there is a bug. Still investigating.

    Plugin Author Ajay

    (@ajay)

    Hi,

    v2.0.0 should fix this bug where queries were being overwritten incorrectly.

    Thread Starter dayin

    (@dayin)

    Thanks Ajay. Just updated to v2.0.0 and everything is working.

    Plugin Author Ajay

    (@ajay)

    Thanks for confirming!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Removing filter and pages in search results’ is closed to new replies.