Last active
October 4, 2019 17:52
-
-
Save jchristopher/840c7455338ae761bf9992ce1e3a22bd to your computer and use it in GitHub Desktop.
Compatibility for AE Pro search results to prevent it 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 | |
// Compatibility for AE Pro search results to prevent it from overriding SearchWP's results. | |
add_filter( 'posts_pre_query', function( $posts, $wp_query ) { | |
if ( did_action( 'ae_pro_search' ) && $wp_query->is_search() ) { | |
$posts = array_keys( SWP()->results_weights ); | |
$wp_query->found_posts = SWP()->foundPosts; | |
$wp_query->max_num_pages = SWP()->maxNumPages; | |
} | |
return $posts; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment