Debugging WordPress Media imports

If you’re working with a complicated site then you may find that importing files and posts into WordPress is a bit of a black art – there are lots of places where things might go wrong. If the upload_url_path value for your site has been manually changed, then this might cause problems with WP export files.

Q: why would you change upload_url_path?

A: changing upload_url_path lets WordPress serve images etc. from a subdomain or different domain, which should improve site performance if you have an image-heavy site.

This is an example item entry from the WordPress eXtended RSS export file (this is a simplified entry, with most of the post data (comment status, stickiness, time, post ID etc. removed for clarity).

	<pubDate>Fri, 15 May 2009 20:20:12 +0000</pubDate>
	<guid isPermaLink="false"></guid>
	<content:encoded><![CDATA[neon, sign, Rue de la Paix, Paris, France]]></content:encoded>
	<excerpt:encoded><![CDATA[Rue de la Paix, Paris, France]]></excerpt:encoded>

The problem is with this line:


The attachment url line doesn’t contain a protocol – either http or https – which is why my media import failed. A protocol isn’t needed when you change the upload_url_path value – but it is needed when WP is importing media.


1. Post-export: grep the file – add a transport protocol to the url – i.e. http: or https: Don’t forget to add the : after the protocol – the wp:attachment_url line should now look like this:


2. Pre-export: check your media library settings and make sure a protocol is included:

NB: you only see these options in your Media Settings page if you have changed the value of upload_url_path.

What do you think?

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