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

Reply To: A Quick help is needed

#34310
Ernest MarcinkoErnest Marcinko
Keymaster

Thanks Thon!

It seem to work all right on that site, when I disable the search override feature, so this might be related to something else as well unfortunately.

One last thing you can try on the live site via a custom code:

add_action('wp_footer', 'wp_footer_asp_custom_redirect', 9999);
function wp_footer_asp_custom_redirect() {
	?>
	<script>
	(function($){
		let url = 'https://www.khmeradverts.com/';
		
		$('input.orig').on('keydown', function(e){
			let keycode =  e.keyCode || e.which;
			if ( keycode == 13 ) {
				e.preventDefault();
				e.stopPropagation();
				location.href = url + '?s=' + $(this).val() + '&category=&location=&a=true';
			}
		});
		$('.promagnifier').on('click touchstart', function(e){
			e.preventDefault();
			e.stopPropagation();
			location.href = url + '?s=' + $(this).closest('.asp_m').find('input.orig').val() + '&category=&location=&a=true';
		});
	})(jQuery);
	</script>
	<?php
}

This will completely prevent any return key or input actions when doing the search, and only does a redirection there. 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.

If this does not work, then there is something else conflicting there.