Fixed: XMLRPC Stopped Working After Switching To HTTPS

I’ve taken advantage of some down time over the past few weeks to migrate all of my sites over to HTTPS (a topic for another post).

However, one issue that I’ve run into is that XMLRPC stopped working on my WordPress site following my update to HTTPS. I didn’t change a single line of code, but started getting the following error:

“An error occurred – -32300:transport error – HTTP status code was not 200”

I tried increasing my php.ini, looking through my server logs, and Googling for solutions, but couldn’t find anything. There were a few people who seemed to have the same issue, but no solutions.

Finally, I came across this post on Stack Exchange that provided some code that did the trick:

The previous code I used was as follows:

include_once(ABSPATH . WPINC . ‘/class-IXR.php’);
$client = new IXR_Client(‘https://www.salsabythebay.com/xmlrpc.php’);
if (!$client->query(‘wp.getCategories’,”, ‘username’,’password’)) {
die(‘An error occurred – ‘.$client->getErrorCode().”:”.$client->getErrorMessage());
}

The updated code which fixed the issue is as follows:

include_once(ABSPATH . WPINC . ‘/class-wp-http-ixr-client.php‘);
$client = new WP_HTTP_IXR_CLIENT(‘https://www.salsabythebay.com/xmlrpc.php’);
if (!$client->query(‘wp.getCategories’,”, ‘username’,’password’)) {
die(‘An error occurred – ‘.$client->getErrorCode().”:”.$client->getErrorMessage());
}

I had no idea this file existed previously or why it works, but switching from class-IXR.php to class-wp-http-ixr-client.php seemed to do the trick.

The XMLRPC API for WordPress is poorly documented so hopefully this will help save you a few hours of digging around trying to solve this problem!

Takeshi Young

About Takeshi Young

Takeshi Young is an SEO and online marketer with 6+ years of experience in the industry. His specialties are technical SEO and social media marketing. He is also passionate about salsa dancing, and performs and competes around the country.

Read Takeshi Young's full bio →

Leave a Reply

Your email address will not be published. Required fields are marked *