Created
May 14, 2020 23:36
-
-
Save jchristopher/b619d5491d996bbc41b82a8388dbc448 to your computer and use it in GitHub Desktop.
Prevent JetSmartFilters from overriding SearchWP's results
This file contains hidden or 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/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