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

Reply To: Cannot get search to function correctly

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Cannot get search to function correctly Reply To: Cannot get search to function correctly

#36254
Ernest MarcinkoErnest Marcinko
Keymaster

Hi!

I believe the issue is caused by the anchor tag, where the search is printed into. Whenever the icon is clicked, the surrounding anchor also triggers, and refreshes the page.

The simplest solution is probably removing the “href” attribute programmatically. Try adding this code 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_custom_footer_script', 999);
function asp_custom_footer_script() {
	?>
	<script>
	jQuery(function($){
		$('.menu-item .asp_w').closest('a').removeAttr('href')
	});
	</script>
	<?php
}

Please note, that this is not a plugin related issue, as a 3rd party menu tag is causing it, so I can not guarantte this will work in all scenarios.