Version 4 Documentation

Compatibility with JetSmartFilters for Elementor

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

Using JetEngine Listing Grid

To integrate SearchWP’s results when using a JetEngine Listing Grid to display results, you can use this hook:

All hooks should be added to your custom SearchWP Customizations Plugin.

// Integrate SearchWP with JetSmartFilters search using
// JetEngine Listing Grid to display results.
// @link
add_action( 'pre_get_posts', function( $wp_query ) {
if (
! isset( $wp_query->query['jet_smart_filters' ] )
|| empty( $wp_query->query['s'] )
) {
$swp_query = new \SWP_Query( array(
'engine' => 'default',
's' => $wp_query->query['s'],
'fields' => 'ids',
'nopaging' => true
) );
$results = ! empty( $swp_query->posts ) ? $swp_query->posts : array( 0 );
$wp_query->set( 'post__in', $results );
$wp_query->set( 'post_type', 'any' );
$wp_query->set( 'post_status', 'any' );
$wp_query->set( 'orderby', 'post__in' );
$wp_query->set( 'order', 'DESC' );
$wp_query->set( 's', false );
}, 9999 );

Using Elementor Pro Archive

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 use 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:

// Prevents JetSmartFilters from overriding SearchWP's results.
// @link
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 );

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.