Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created May 14, 2020 23:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/b619d5491d996bbc41b82a8388dbc448 to your computer and use it in GitHub Desktop.
Save jchristopher/b619d5491d996bbc41b82a8388dbc448 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/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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment