Default Green Orange
Swifty's Blog
James Irving-Swift's portfolio and random blogging
RSS
  • Home Page Home
  • My CV

Ajax breaks in wordpress if back-end uses SSL

Development Add comments

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:

get_admin_url(null,'','http');

I hope this helps a lot of people!


March 3rd, 2012  

2 Responses to “Ajax breaks in wordpress if back-end uses SSL”

  1. Kristof De Buysere
    June 2nd, 2012 at 14:06

    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?


  2. Swifty
    June 2nd, 2012 at 15:49

    Hi Kristof,

    Normally, in the javascript for your AJAX call, there will be a url parameter.
    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

    I hope this helps.

    Swifty


Leave a Reply

  • Search

  • Calendar

    March 2012
    M T W T F S S
    « Nov   May »
     1234
    567891011
    12131415161718
    19202122232425
    262728293031  
  • My Twitter

    • @skyatlantic why is sky atlantic HD the only channel that apparently can get signal?!? 4 days ago
    • @miniviolette it was… I realised that I was to drunk to continue when I only got one kill in battlefield3 in 30 mins!!!! epic fail! 1 week ago
    • @miniviolette yeah! i just stay in an played xbox and didn't pay attention to how much I was drinking at the same time! Amateur Mistake! 1 week ago
    • This sums up my Saturday morning! http://t.co/yBuMQ0afMy 1 week ago
    • @Rich_McCartney I'm still on Lion, i really need to sort out mountain lion so that my thunderbolt display stops being buggy! 1 week ago
  • Categories

    • Development
    • Development
    • JISCMail
    • Just for fun
    • Linux
    • Magento
    • Mailtalk
    • Mutiny
    • Random
    • Thomas Murr Art
    • Ubuntu
    • Websites
    • Wordpress
  • Archives

    • May 2012
    • March 2012
    • November 2011
    • May 2011
    • October 2010
    • September 2010
    • July 2010
    • April 2010
    • March 2010
    • SN205662 Samsung digital camera
    • SN205661 Samsung digital camera
    • SN205660 Samsung digital camera
    • SN205658 Samsung digital camera
    • SN205659 Samsung digital camera
    • SN205657 Samsung digital camera
    • SN205656 Samsung digital camera
    • SN205655 Samsung digital camera
    • SN205654 Samsung digital camera
    • SN205653 Samsung digital camera
    • SN205651 Samsung digital camera
    • SN205652 Samsung digital camera
    • SN205650 Samsung digital camera
    • SN205649 Samsung digital camera
    • SN205648 Samsung digital camera
    • SN205644 Samsung digital camera
    • SN205625 Samsung digital camera
    • SN205639 Samsung digital camera
    • SN205626 Samsung digital camera
    • SN205636 Samsung digital camera
Copyright © 2013 Swifty's Blog
XHTML CSS Log in