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

Reply To: Issue with combining two searches and displaying the results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issue with combining two searches and displaying the results Reply To: Issue with combining two searches and displaying the results

#42708
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Thank you for the details!

As long as the filters are identical on both instances, there is a way to force them to work together, but it involves a bit of custom code – nothing too fancy.

Try adding this code via the Code Snippets or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

add_action('wp_footer', 'asp_change_query_args_for_compatibility');
function asp_change_query_args_for_compatibility() {
	?>
	<script>
	window.addEventListener('load', function () {
		WPD.Hooks.addFilter('asp_redirect_url', function(url){
			url = url.replace(/\?s\=(.*?)\&/, '?s=$1&asp_s=$1&');
			return url.replace(
				"p_asid=2", 
				"p_asid=1"
			);
		}, 10);
	});
	</script>
	<?php
}

This will force a trigger for the second search bar when a redirection is made throught the header search.