Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created February 9, 2022 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searchwpgists/26cba3f78854918914bea4dce5eca4ee to your computer and use it in GitHub Desktop.
Save searchwpgists/26cba3f78854918914bea4dce5eca4ee to your computer and use it in GitHub Desktop.
Prevent JetSmartFilters from overriding SearchWP's results
<?php
// Prevents JetSmartFilters from overriding SearchWP's results.
// @link https://searchwp.com/documentation/knowledge-base/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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment