Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › Remove S&F on search page
- This topic has 11 replies, 3 voices, and was last updated 4 years, 2 months ago by Trevor.
-
Noeste IJver(Private) February 6, 2020 at 9:43 am #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=ouderenMultisite search:
https://tvgg.nl/zoeken/?search_mode=multisite&s=ouderenThe 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(Private) February 6, 2020 at 11:26 am #233165Search 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(Private) February 6, 2020 at 12:49 pm #233183Hi 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(Private) February 6, 2020 at 12:55 pm #233192Not 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(Private) February 6, 2020 at 1:16 pm #233198For 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(Private) February 6, 2020 at 1:31 pm #233202You won’t be able to remove our query, only add yours after ours.
Noeste IJver(Private) February 6, 2020 at 1:39 pm #233204But: 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(Private) February 6, 2020 at 1:53 pm #233207This reply has been marked as private.Ross Moderator(Private) February 7, 2020 at 11:28 am #233326Hi 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(Private) February 10, 2020 at 2:00 pm #233532Hi 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?
-
AuthorPosts
The topic ‘Remove S&F on search page’ is closed to new replies.