Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Predictive search not working
- This topic has 11 replies, 2 voices, and was last updated 9 years, 2 months ago by
kensacreative.
-
AuthorPosts
-
March 29, 2017 at 9:58 am #12520
kensacreative
ParticipantHello,
Something has happened to our search bar. The predictive search no longer works.
I am currently doing some checks and updates, so i cloned the main website (http://skillssearch.marchesgrowthhub.co.uk/) to: http://skilltest1.wpengine.com/
Can you please look into this, as the client looking for answers asap.
thx
Sud
March 29, 2017 at 10:05 am #12521Ernest Marcinko
KeymasterHi,
Just checked, but I’m getting results as I’m typing (on the main site): http://i.imgur.com/cvpIGxO.png
I see however one javascript issue in the console, coming from one of the theme javascript files (smoothscroll.js): http://i.imgur.com/96K0qvf.png
That can cause blocking javascript errors, and possibly the failure of the search script as well, it’s definitely worth investigating.March 29, 2017 at 10:29 am #12522kensacreative
ParticipantYou cannot access this content.
March 29, 2017 at 10:32 am #12524kensacreative
ParticipantYou cannot access this content.
March 29, 2017 at 10:40 am #12526Ernest Marcinko
KeymasterHi,
I can’t access the site, it requires .htpassword login.
From the error message on the second screenshot, there it appears that you either try to view the site on “http” protocol, but the main ajax URL is set to ‘https’ (or vice versa), which causes the problem, as it qualifies as CORS request.
I recommend changing all base URLs to either use the “http” or the “https” version (on wordpress back-end), or allow cross origin access via .htaccess. Also, you have a .htpassword protection, which can also block the ajax requests, but I don’t think that is the problem here.
March 29, 2017 at 10:42 am #12527kensacreative
ParticipantYou cannot access this content.
March 29, 2017 at 11:36 am #12528Ernest Marcinko
KeymasterHi,
Please read my previous response, the problem is exactly what I expected. WordPress returns the incorrect ajax URL (with ‘https’), because it thinks that the current site is using SSL. The plugin uses the WordPress code admin_url() function to parse it. Make sure to correct the site URL and that there is no rule forcing to redirect to the ‘https’ version in the .htaccess file.
As a bypass solution you can try this code:
This is however only a bypass, I would still recommend investigating why the site returns an incorrect ajax url.
March 29, 2017 at 11:43 am #12529kensacreative
Participantmagic! It works when we add “https://” before the domain
It works on this URL now: https://skillstemp1.wpengine.com/
Thanks for you help and support!
March 29, 2017 at 2:50 pm #12533kensacreative
ParticipantHello,
Just so we’re on the same.
I am sending you a screenshot of the where i need add the following code, please so I dont mess this up
add_filter(‘admin_url’, ‘asp_change_admin_url’, 99999, 1);
function asp_change_admin_url($url) {
return str_replace(‘https:’, ‘http:’, $url);
}March 30, 2017 at 8:54 am #12537Ernest Marcinko
KeymasterHi,
You can add it below this line:
[php]// END ENQUEUE PARENT ACTION[/php]
But I highly recommend using an FTP editor, and using a back-up copy of everything before editing the files. If anything goes wrong, you can then restore it.
March 30, 2017 at 9:52 am #12539kensacreative
Participantso like this right? Sorry my PHP isn’t great
// END ENQUEUE PARENT ACTION
add_filter(‘admin_url’, ‘asp_change_admin_url’, 99999, 1);
function asp_change_admin_url($url) {
return str_replace(‘https:’, ‘http:’, $url);
}March 30, 2017 at 11:58 am #12541kensacreative
Participantworking – thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.