I have been trying to export my WordPress posts in order to import them into a clean WordPress install. The post are imported, however the featured images is not imported.
I have made sure I exported a small number of posts to rule out a timeout error.
I took a look at the xml of the export and could not find a xml value with a related jpg for the post. Here is one post item from my export xml (edited for privacy):
I do notice the meta key of ” _thumbnail_id “.
<item>
<title> MY POST TITLE </title>
<link>http://www.MY-DOMAIN-NAME.com/MY POST TITLE/</link>
<pubDate>Mon, 01 Jul 2013 17:31:11 +0000</pubDate>
<dc:creator> AUTHOR </dc:creator>
<guid isPermaLink="false">http://www.MY-DOMAIN-NAME.com/?p=12429</guid>
<description></description>
<content:encoded><![CDATA[http://youtu.be/VIDEOCODE
<a href="http://www.MY-DOMAIN-NAME.com/?s=MY+QUERY" class="mo">Read More...</a>]]>
</content:encoded>
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
<wp:post_id>12429</wp:post_id>
<wp:post_date>2013-07-01 12:31:11</wp:post_date>
<wp:post_date_gmt>2013-07-01 17:31:11</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>MY-POST-TITLE</wp:post_name>
<wp:status>publish</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:is_sticky>0</wp:is_sticky>
<category domain="category" nicename="music-videos"><![CDATA[Music
Videos]]></category>
<category domain="post_tag" nicename="MY-TAG"><![CDATA[RMY TAG]]>
</category>
<category domain="category" nicename="reggae-music-video"><![CDATA[Reggae Music Videos]]></category>
<category domain="category" nicename="video"><![CDATA[Video]]></category>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value><![CDATA[9]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_thumbnail_id</wp:meta_key>
<wp:meta_value><![CDATA[12431]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>robotsmeta</wp:meta_key>
<wp:meta_value><![CDATA[index,follow]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_oembed_c0627bbe93a4ea2be1138b1197ad7c</wp:meta_key>
<wp:meta_value><![CDATA[<iframe width="500" height="281"
src="http://www.youtube.com/embed/4ZlUX9o8D1I?feature=oembed" frameborder="0"
allowfullscreen></iframe>]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>idptt_tweeted</wp:meta_key>
<wp:meta_value><![CDATA[1]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_oembed_40c0cae11733595001b4711ce77e07</wp:meta_key>
<wp:meta_value><![CDATA[<iframe width="584" height="329"
src="http://www.youtube.com/embed/VIDEOCODE?feature=oembed" frameborder="0"
allowfullscreen></iframe>]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_oembed_2fc8ceb52fa6df35be292c5639fef0</wp:meta_key>
<wp:meta_value><![CDATA[<iframe width="540" height="304"
src="http://www.youtube.com/embed/VIDEOCODE?feature=oembed" frameborder="0"
allowfullscreen></iframe>]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_oembed_80aa58fde2202424507180b82beb0b</wp:meta_key>
<wp:meta_value><![CDATA[<iframe width="620" height="349"
src="http://www.youtube.com/embed/VIDEOCODE?feature=oembed" frameborder="0"
allowfullscreen></iframe>]]></wp:meta_value>
</wp:postmeta>
</item>
When you export posts instead of all content the post type attachment is not exported which I think before was not happening. So either export all content, or take the “all content” xml file and copy all the items that are post type = Attachment.
UPDATE:
I created a plugin to export featured images. You can find it in WordPress Repository
On my host this plugin doesn’t work, so I write a simple script to update links to images and import metadata.