How to disable Relevanssi

If you need to disable Relevanssi, for example for a particular template, all you need to do is to unhook two filter hooks:

remove_filter('posts_request', 'relevanssi_prevent_default_request'); 
remove_filter('the_posts', 'relevanssi_query');

Removing these two filters disables Relevanssi.

  • boeselhack

    Hi Mikko,
    how can I disable your great plugin just on one certain page?
    Thx!

    • With these remove_filter() calls, just run them where you need to disable Relevanssi.

      • boeselhack

        Thank you, but how can I achieve/run it? Do I have to add the code to the template (PHP file) of the plugin? If so, that’s not what I want. It would change the plugin on all sites. I just want to use it on one page. I tried some conditional tags (https://codex.wordpress.org/Conditional_Tags) for functions.php, but unfortunately I could not bring it to work.
        I also tried a plugin (https://wordpress.org/plugins/insert-php-code-snippet/) to insert your codes into a page, but it also didn’t work.
        Sorry, I’m not a programmer :/

        • In that case I recommend you hire a programmer. You need to edit your theme (or build a plugin for it), not the Relevanssi plugin files. Disabling on just one page is a bit tricky (and I do wonder what you’re trying to achieve; this isn’t necessarily the right way to do it), but a skilled WP developer should be able to handle it.

          • boeselhack

            Ok thank you!
            I use your search because it’s great!
            But it breaks the search function of the WPDM (WordPress Download Manager Plugin), which I use on only one page. Therefor I would like to disable it there. I’ll ask my buddy to do that, thought it would be easier…
            Thanks again for your supply!