Word Press Importer – Remote server did not respond

I had this issue when importing media from a site protected with an SSL certificate to a development site on the same server.

After a lot of googling and adding extra (useful) debugging code to wordpress-importer.php I found that the issue was that cURL was failing to verify the certificate (possibly due to it connecting locally).

After a lot of searching I failed to find a way to temporarily prevent the importer checking the certificate, but with a bit of persistence I found that adding the following two lines to the file wp-content/plugins/wordpress-importer.php

Find the lines :

function fetch_remote_file( $url, $post ) {
add_filter( 'http_request_host_is_external', '__return_true' );

for me they were found starting on line 982

Add the following below the two lines

add_filter( 'https_local_ssl_verify', '__return_false' );
add_filter( 'https_ssl_verify', '__return_false' );

and re-run the import.

I doubt both are necessary, but adding both will cover more SSL eventualities.

Remember to remove them after your import to reduce the likelihood of the settings being exploited.