Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Clicking on a suggested search keyword › Reply To: Clicking on a suggested search keyword
September 15, 2023 at 4:24 pm
#45399
Keymaster
Hi,
While there is no option to do that, it should be doable via a bit of custom code to trigger a redirection.
Try adding this code via the Code Snippets plugin 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_add_footer_script', 99999);
function asp_add_footer_script() {
?>
<script>
jQuery(function($){
$('.asp-try a').on('click', function(e){
let id = $(this).closest('.asp_w_container').data('id');
ASP.api(id, 'hideResults');
ASP.api(id, 'searchRedirect', jQuery(this).text());
});
});
</script>
<?php
}