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)