Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When I generate XML file with [Tools > Export] and use [Tools > Import] on another WordPress website I get "Failed to import Media" for each attachment post type. And images that failed to load are hotlinked from the previous server which consumes the transfer of that previous server...

But when I download "Unit Test" from http://codex.wordpress.org/Theme_Unit_Test then this problem doesn't exist. Some images still have "Failed to import Media" but it's only like 5 out of 30 images. They have URLs to their own server in their XML but somehow [Tools > Import] manages to download their media and replace these URLs with new locations (it is not hotlinked anymore).

What's the trick to make it work properly without "Failed to import Media"? Why even "Unit Test" has a few "Failed to import Media" messages?

share|improve this question
    
As the server where you import needs to get them from the old location you should not only check if the files are at the old server, but also if the new server can fetch them. Maybe something limits outbound requests. Have you tried importing it on another server or localhost? I am afraid this could be a very localised issue. –  kraftner Jun 6 at 15:49

1 Answer 1

When you generated your export file, was it on a live server or a localhost? Is that web page still accessable? If the media import fails, it means the images, as linked out of the XML, are coming up 404.

Open up the XML file and see where the images are pointing. If we open up the Theme Unit XML file, we will see lines like this:

<wp:attachment_url>http://wpthemetestdata.files.wordpress.com/2008/06/canola2.jpg</wp:attachment_url>

That file is very clearly available for import. What do your attachment_url files say?

share|improve this answer
1  
I mentioned "And images that failed to load are hotlinked from the previous server which consumes the transfer of that previous server..." which indicates that images do not return 404, they are not on localhost but they still generate "Failed to import Media". My <wp:attachment_url> says example.com/2008/06/image.jpg too where example.com is always accessible domain. That's why I'm asking this question :) It clearly doesn't work even if images do not generate 404. It even doesn't work with wpthemetestdata.files.wordpress.com occasionally (~5 random images out of 30 fail). –  Paul Oct 10 '13 at 7:53
    
Right, sorry, my mind is a bit burned out at this point in the night. Do you have some kind of hotlink protection on the server? –  Imperative Ideas Oct 10 '13 at 8:19
1  
Nope, it's publicly accessible server with publicly accessible images, no protection whatsoever. But even if there was some protection, WordPress's server does the same thing occasionally. Does it mean that this importer is just buggy? –  Paul Oct 10 '13 at 8:35
    
That or one of the servers has an obnoxiously short timeout value. I'm fresh out of ideas for you. Does the XML import properly to Localhost? If so, you can sort of cheat... do the import locally then use WP Migrate DB and clone the result to live. –  Imperative Ideas Oct 10 '13 at 8:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.