-
-
Save searchwpgists/26cba3f78854918914bea4dce5eca4ee to your computer and use it in GitHub Desktop.
Prevent JetSmartFilters from overriding SearchWP's results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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