So you have a wordpress blog and you (or your client) want the wp-admin to use an SSL certificate, sounds great! However, any AJAX you use in your site has broken. I spent a while googling this issue when it happened to me and found a really easy fix; you need to change the variables in the get_admin_url() function to force the AJAX requestion to use http instead of https. Change it to look like:
I hope this helps a lot of people!
March 3rd, 2012
3 Responses to “Ajax breaks in wordpress if back-end uses SSL”
Interesting! I am currently having problems with a website I am building, and where I added an SSL certificate. Since then, AJAX went bananas… In what file can I find the get_admin_url() function that I need to change?
I, prior to using SSL, would have a line that looked like so: url: <?php echo get_admin_url(); ?>/admin-ajax.php
To get this to work with SSL, I changed it to: url: <?php echo get_admin_url(null,'','http); ?>/admin-ajax.php