• Hello!
    I wanted to point out the fact that your plugin affects also WP API search.
    You can try with this plugin or even just using the WP API search request, like
    https://yoursite.com/wp-json/wp/v2/some_post_type?search=yoursearch
    on any site (post type must have a registered route).

    How can we disable all Relevanssi filters when using the WP API?

    Thanks

    • This topic was modified 8 years, 1 month ago by Duke.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes, this is a known compatibility issue. You need to run this to stop Relevanssi from blocking the default search:

    remove_filter('posts_request', 'relevanssi_prevent_default_request', 10, 2 );

    I’m not familiar enough with the API to tell how to do this just for the API, but adding this code for all cases won’t break Relevanssi.

    Thread Starter Duke

    (@dukessa)

    That worked perfectly, thanks!
    So this will not break the way Relevanssi normally works?
    Do I need to re-add the filter after the API search logics?
    How do I check, in search results page, that the search is in fact still managed by Relevanssi?

    • This reply was modified 8 years, 1 month ago by Duke.
    • This reply was modified 8 years, 1 month ago by Duke.
    Plugin Author Mikko Saari

    (@msaari)

    No, it doesn’t affect the normal operations of Relevanssi; all that filter does is to disable the default WP search. It’s a performance thing – you don’t want to waste time on doing the WP search if you’re not going to use those results.

    There are plenty of ways to see if the results are powered by Relevanssi: you can disable Relevanssi or change Relevanssi settings and see if the results change. One quick way is to add ?post_types=page to the search page URL and see if the results show only pages – that parameter is Relevanssi-specific and won’t do anything on regular WP search.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Compatibility issue with WP API search’ is closed to new replies.