This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: View Custom Query Before Ajax Search in Elementor Pro

Home Forums Product Support Forums Ajax Search Pro for WordPress Support View Custom Query Before Ajax Search in Elementor Pro Reply To: View Custom Query Before Ajax Search in Elementor Pro

#38435
Ernest MarcinkoErnest Marcinko
Keymaster

Thank you very much, that worked perfectly.

I think I found the best possible solution to this. At first it seemed it may not be possible, but there is such a simple way to solve this.
I have changed your custom query code via FTP to this:

function my_query_by_post_types( $query ) {
	if ( !isset($_GET['asp_ls']) ) {
		$query->set( 'post_type', [ 'post', 'resources' ] );
	}
}
add_action( 'elementor/query/insightsquery', 'my_query_by_post_types' ); 

All this does, is basically ignore your query arguments, when the asp_ls server reqest variable is detected. When that variable exists, it means, that Ajax Search Pro is instructed to override the elementor posts. By ignoring the query arguments in that case, the search can safely override the default Elementor results.