Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Remove S&F on search page

Viewing 10 posts - 1 through 10 (of 12 total)
  • Noeste IJver
    #233158

    Hello,

    We are using S&F on a multisite. We use a S&F form for searching the website we are on. But we also made a function to switch to multisite search (standard WP search with Relevanssi for searching other subsites in the multisite). We use both search functions on the same page.

    S&F search:
    https://tvgg.nl/zoeken/?_sf_s=ouderen

    Multisite search:
    https://tvgg.nl/zoeken/?search_mode=multisite&s=ouderen

    The problem with the multisite search is that it still only shows results from the current website. And I guess that is because there is still something from S&F active.

    When I pass the sfid query variable as 0, it shows the results.

    https://tvgg.nl/zoeken/?search_mode=multisite&s=ouderen&sfid=0

    But then the pagination isn’t working properly. I would like to remove the S&F stuff from the query when using multisite search, in a way the pagination still works. How can I achieve that?

    Trevor Moderator
    #233165

    Search and Filter does not, at the point the user makes a ‘search’, actually search the site tables. Instead, it searches its own cache table, finds the matching post IDs, and asks the site to deliver those posts as results.

    As the S&F cache table is a cache of only the terms from the current site posts and post meta tables, a multisite search will not work.

    Noeste IJver
    #233183

    Hi Trevor,

    I understand that S&F doesn’t do multisite search. Therefore we made a separate search function, which is at the same page. The problem is, that this page still thinks it should use the S&F form/results.

    Is there a way to disconnect the S&F from the query/results before the query has run?

    Trevor Moderator
    #233192

    Not if you are using the As an Archive display results method, no. If you want to override our filter on the page, you could apply the query not using the wp_query() function but instead using pre_get_posts(). That would likely override anything that our plugin is doing.

    Noeste IJver
    #233198

    For the search page, we are using it as an archive.

    I’ve tried to remove the sfid value from the query with pre_get_posts. It removes the value, but the S&F functionality is still there it seems.

    I’ve also tried to do this:

    remove_action('parse_request', 'archive_query_init', 10 );

    But no luck there..

    Trevor Moderator
    #233202

    You won’t be able to remove our query, only add yours after ours.

    Noeste IJver
    #233204

    But: how is it possible when I apply sfid=0, the results do show results from other subsites? It seems that (somehow) it is possible to override your query by just removing/disabling the sfid..

    Trevor Moderator
    #233207
    This reply has been marked as private.
    Ross Moderator
    #233326

    Hi Kevin

    I’m trying to have a look at this for you but it seems your example URLs are not showing anything (404) ?

    I think what you are trying to should be possible, its a matter of removing the hooks at the right time.

    Thanks

    Noeste IJver
    #233532

    Hi Ross,

    You might have been looking when I was testing some stuff. Are the URLs working for you now?

    I’m not quite sure which hooks I should remove at what moment. Could you help me out with that?

Viewing 10 posts - 1 through 10 (of 12 total)

The topic ‘Remove S&F on search page’ is closed to new replies.