SearchWP

This Documentation is for SearchWP Version 3

Compatibility with JetSmartFilters for Elementor

Note: This documentation is for SearchWP 3.x
SearchWP 4: Compatibility with JetSmartFilters for Elementor

SearchWP works with Elementor custom Search Archive templates, but JetSmartFilters overrides SearchWP’s results by hijacking archive queries.

There are two options if you’re running into this problem. If you are not using JetSmartFilters on any archive pages you can navigate to the following WordPress Admin Menu screen: Elementor > JetSmartFilters Settings and un-tick this checkbox:

Once that is un-ticked you can click the Save button and the issue will be resolved.

If, however, you are using JetSmartFilters on other archive pages, you can instead us this snippet to disable JetSmartFilters on search archive pages, allowing you to use Elementor’s Search Archive Template customization, utilizing the Elementor Archive Posts Widget to display the search results.

It’s a a quick fix; you can add this snippet to your theme’s functions.php (or a custom plugin you’ve built) and it will allow SearchWP’s results to be displayed:

<?php
// Prevents JetSmartFilters from overriding SearchWP's results.
// @link https://searchwp.com/v3/docs/kb/compatibility-with-jetsmartfilters-for-elementor/
add_action( 'init', function() {
add_filter( 'elementor/theme/posts_archive/query_posts/query_vars', function( $query ) {
if ( is_search() && is_main_query() ) {
remove_all_filters( 'elementor/theme/posts_archive/query_posts/query_vars' );
}
return $query;
}, -1 );
}, -998 );
view raw functions.php hosted with ❤ by GitHub

The above snippet takes advantage of Jet Smart Filter’s priorities of its internal hooks to prevent it from overriding SearchWP’s results on search results archive pages.