WordPress Failed To Import Media
-
Hi,
tl;dr version: Attachment import isn’t working (displaying a Failed to import “media file name” error) and none of the usual fixes are resolving the issue.
I have a site that is shutting down and I’m trying to import the content into a new site.
However, a lot of the media is failing to import. This seems like a fairly common issue, with plenty available on this forum but none of the fixes seem to have worked. To clarify, these are the steps I’ve taken:
- I have ensured I’m exporting “all content” when creating the XML.
- I have ensured “Download and import file attachments” is selected when importing the file into the new site
- I have ensured the XML file is within the 50MB limit imposed by WordPress
- I have added the following lines to my wp-config.php file to increase the amount of memory available to PHP:
define('WP_MEMORY_LIMIT', '600M'); define( 'WP_MAX_MEMORY_LIMIT', '600M' );
- I have had my hosting provider change the line in PHP.ini where line shows 32M to 256M: memory_limit = 256M; Maximum amount of memory a script may consume (64MB)
- I have disabled all plugins
- I have tried regenerating the XML file from the original site
Variations of those seem to be the suggestions that have fixed it for everyone else.
What happens when I import is that all of the posts, pages, categories and tags import. Several of the images do import onto the new server and display correctly but most either
- Fail and do not import at all or,
- Hotlink the images from the original site
I have verified that the files that are failing are in the XML and they appear to be formed correctly and identically to the files that are not failing.
For example, here is an image that is not failing:
<item> <title>the-lone-ranger-and-tonto-halloween-costume</title> <link>https://www.oldsite.com/lol/5-halloween-costumes-you-can-use-right-now/attachment/the-lone-ranger-and-tonto-halloween-costume/</link> <pubDate>Wed, 22 Oct 2014 21:42:56 +0000</pubDate> <dc:creator><![CDATA[andrewmorgan]]></dc:creator> <guid isPermaLink="false">https://www.oldsite.com/wp-content/uploads/2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg</guid> <description></description> <content:encoded><![CDATA[]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>430</wp:post_id> <wp:post_date>2014-10-22 22:42:56</wp:post_date> <wp:post_date_gmt>2014-10-22 21:42:56</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>the-lone-ranger-and-tonto-halloween-costume</wp:post_name> <wp:status>inherit</wp:status> <wp:post_parent>426</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>attachment</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <wp:attachment_url>https://www.oldsite.com/wp-content/uploads/2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg</wp:attachment_url> <wp:postmeta> <wp:meta_key>_wp_attachment_image_alt</wp:meta_key> <wp:meta_value><![CDATA[the lone ranger and tonto halloween costume]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key>_wp_attached_file</wp:meta_key> <wp:meta_value><![CDATA[2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key>_wp_attachment_metadata</wp:meta_key> <wp:meta_value><![CDATA[a:5:{s:5:"width";i:620;s:6:"height";i:400;s:4:"file";s:55:"2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg";s:5:"sizes";a:7:{s:9:"thumbnail";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-620x400.jpg";s:5:"width";i:620;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:10:"post-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-620x400.jpg";s:5:"width";i:620;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:12:"square-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-240x225.jpg";s:5:"width";i:240;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:11:"small-thumb";a:4:{s:4:"file";s:53:"the-lone-ranger-and-tonto-halloween-costume-85x54.jpg";s:5:"width";i:85;s:6:"height";i:54;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:11:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";s:11:"orientation";i:0;}}]]></wp:meta_value> </wp:postmeta> </item>
And here is an image that is failing:
<item> <title></title> <link>https://www.oldsite.com/cool/what-happens-when-football-boots-meet-transformers/attachment/footballboottransformers22/</link> <pubDate>Mon, 26 Oct 2015 18:08:17 +0000</pubDate> <dc:creator><![CDATA[alasdair-jessup]]></dc:creator> <guid isPermaLink="false">https://www.oldsite.com/wp-content/uploads/2015/10/footballboottransformers22.jpg</guid> <description></description> <content:encoded><![CDATA[]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>2932</wp:post_id> <wp:post_date>2015-10-26 18:08:17</wp:post_date> <wp:post_date_gmt>2015-10-26 18:08:17</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>closed</wp:ping_status> <wp:post_name>footballboottransformers22</wp:post_name> <wp:status>inherit</wp:status> <wp:post_parent>2924</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>attachment</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <wp:attachment_url>https://www.oldsite.com/wp-content/uploads/2015/10/footballboottransformers22.jpg</wp:attachment_url> <wp:postmeta> <wp:meta_key>_wp_attached_file</wp:meta_key> <wp:meta_value><![CDATA[2015/10/footballboottransformers22.jpg]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key>_wp_attachment_metadata</wp:meta_key> <wp:meta_value><![CDATA[a:5:{s:5:"width";i:600;s:6:"height";i:400;s:4:"file";s:38:"2015/10/footballboottransformers22.jpg";s:5:"sizes";a:7:{s:9:"thumbnail";a:4:{s:4:"file";s:38:"footballboottransformers22-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:38:"footballboottransformers22-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:38:"footballboottransformers22-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:10:"post-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:12:"square-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-240x225.jpg";s:5:"width";i:240;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:11:"small-thumb";a:4:{s:4:"file";s:36:"footballboottransformers22-85x54.jpg";s:5:"width";i:85;s:6:"height";i:54;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:11:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";s:11:"orientation";i:0;}}]]></wp:meta_value> </wp:postmeta> <wp:postmeta> <wp:meta_key>_wp_attachment_image_alt</wp:meta_key> <wp:meta_value><![CDATA[footballboottransformers22]]></wp:meta_value> </wp:postmeta> </item>
If anyone has any ideas, I would be most grateful as I’ve spent the last 7 hours trying to resolve it without success!
- The topic ‘WordPress Failed To Import Media’ is closed to new replies.