The WordPress Importer plugin does not import images when you import separately posts, pages, …. Even importing it all together does not work 100% correctly, it leaves the images in the content linked to the old site and does not keep the featured images.

Media Tools is a very helpful plugin to accomplish this, in combination with the plugin  Set All First Images As Featured.

This plugin has options to import the external images and save the first image found as featured image, the problem is that this last option does not work very well, so it is not worth using this plugin for setting the featured images but only to import external images.

After importing the XML file of the WordPress export, run Media Tools, it will trace the posts looking for src attributes of images found, if these do not exist on the new website, the plugin will upload them to the new uploads folder and update the src attribute of images to the new location.


1. Export posts or pages from the old site. Tools -> Export.

2. Install WordPress Importer in the new site where you will import the exported file.

3. Tools -> Import, select the file. Assign the authors of the posts and check “Download and import file attachments”, this box is to download and import attachments, but as I said before, it will not download or import,  it just adds the url’s of the images in the posts and will continue pointing to the old site.

4. Install the Media Tools plugin, activate it, go to Tools -> Media Tools.

Select the option to import external images. Select the post type where it must perform the tracing (posts, pages, etc.) and click the button below to start the process (as I said before, the option to assign featured images does not work properly so it’s better ignore this option for the moment).

5. The progress bar will display and just below a log of the traced posts with the found and imported images. When the bar reaches 100% the process is complete.

To set the first image as featured.

Install the plugin  Set All First Images As Featured

This plugin will scan looking for images attached to the post and save the first image found as featured. If it doesn’t find any images attached to the post it will look for  src attribute of the first <img> tag in the content of the post, if it finds an image it will save it as the featured one.

Before running this plugin (and generally any plugin that modifies your database) is recommended to do a backup of the database (and in this case specifically the tables postmeta and posts)

How to import images when importing posts from a WordPress export file
Tagged on:             

16 thoughts on “How to import images when importing posts from a WordPress export file

  • February 10, 2016 at 01:49

    Haleluiah! Indded a good solution founded after 3-4 hours of research!

  • February 17, 2016 at 17:22

    Thank you so much, this was a huge problem for me nearly for 1 year, now Im so thankful to you…

  • September 25, 2016 at 21:02

    Hi, there is an update now any one can set first image as featured from media tools. They have added this option.

  • December 3, 2016 at 18:08

    Not working for me. Does this post assume that the media folder has already been exported from the old site and imported into the new site?

  • February 8, 2017 at 13:07

    plugin is complete garbage. it set featured images for all my pages but not my posts

  • August 1, 2017 at 19:33

    Doesn’t work. Images aren’t imported.

  • August 29, 2017 at 08:24

    This worked perfectly fine, it setups the first and expected image as Feature image on each post.
    Thank you so much!

  • February 5, 2018 at 10:37

    thanks a lot…
    it was a very informative article. this is all i need.

    I expect you to publish such articles in future…


  • February 5, 2018 at 10:38

    thanks for this article, it was very helpful….


Leave a Reply

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