Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search phrases aren't triggering search in search bar
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 3 months ago.
- AuthorPosts
- November 26, 2021 at 11:28 am #35752
Hi,
I’ve attached credentials for my staging evironment which is exactly same as my live site.
If you look here: https://staging-deinurlaubsdeal.kinsta.cloud/reisedeals/ (live site: https://dein-urlaubsdeal.de/reisedeals/) you will see your search bar on the right side. Also, there are some search phrases beneth which usually trigger the search above when clicked. Since some weeks this is not working anymore.
The search bar on the homepage is working fine: https://staging-deinurlaubsdeal.kinsta.cloud/ (live site: https://dein-urlaubsdeal.de/).
I already reached out to the support of WPRocket and Perfmatters since these plugins could be having an conflict, but both support teams told me, there is no problem on their side. So could you please take a look and fix this issue?
Thanks
CaioNovember 26, 2021 at 1:54 pm #35759Hi,
It looks like some sort of a minor script conflict to me. The search triggers, but it is immediately cancelled.
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', 'my_custom_wp_footer'); function my_custom_wp_footer() { ?> <script> (function($){ "use strict"; // Top and latest searches widget $(".ajaxsearchprotop").each(function () { let params = JSON.parse( $(this).data("aspdata") ), id = params.id; if (params.action == 0) { $('a', $(this)).on('click', function (e) { e.preventDefault(); }); } else if (params.action == 2) { $('a', $(this)).on('click', function (e) { e.preventDefault(); ASP.api(id, 'searchFor', $(this).html()); $('html').animate({ scrollTop: $('div[id*=ajaxsearchpro' + id + '_]').first().offset().top - 40 }, 500); }); } else if (params.action == 1) { $('a', $(this)).on('click', function (e) { if ( ASP.api(id, 'exists') ) { e.preventDefault(); return ASP.api(id, 'searchRedirect', $(this).html()); } }); } }); })(WPD.dom); </script> <?php }
If all goes well, it should resolve the issue. I will look into this in more details on our test servers.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 14, 2021 at 10:13 am #35956You cannot access this content.December 14, 2021 at 1:21 pm #35959Can you please update to the latest plugin version (4.21.8)? Then try without the code, it may resolve the issue, I remember making changes around that code in the previous release.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 15, 2021 at 10:03 am #35963I’ve already updated the plugin on the live site and tried without the code, still the same issue…
December 15, 2021 at 1:50 pm #35966Can you please try swtiching the javascript source option to “minified” here: https://i.imgur.com/RB2eEt9.png
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 16, 2021 at 11:30 am #35977This worked out, thanks!
December 16, 2021 at 3:46 pm #35985You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.