Exporting WordPress posts with featured images and images included in the posts so that you can import blog posts with all images in tact to a new WordPress install isn’t a particularly common requirement – but when you are faced with moving blog posts from one WordPress website to another the default functionality of WordPress can be found lacking.
The Problem as you may have already discovered…
Using Default WordPress Import / Export to Move Posts between websites
Under “Tools” you’ll find “Import” and “Export” options – great start.
If you export posts from the current WordPress website WordPress generates an XML file – still all good.
You then go to your new WordPress website / live WordPress website and go to Tools > Import
You follow the steps and your WordPress posts get imported to your new WordPress website – but the images are missing… (featured images and post images)
Using Export media with selected content to Export Blog Posts with images
The problem is, the XML file generated when exporting blog posts from WordPress doesn’t include the media*
You therefore need to install a plugin on your existing WordPress website (the website you’re EXPORTING posts from).
The Plugin is Called “Export media with selected content”
This time, when you Import blog posts to WordPress on the new WordPress website, you’ll also have the media files attached to the blog posts imported to your media library.
Problems with Exporting & Importing Posts and Pages to and from WordPress
#1 – The theme you’re using doesn’t “attach” the media to your blog posts or pages
You may have noticed when browsing your Media Library in “list” view that there’s a column called “uploaded to”
This determines whether the image in the media library is actually “attached” to the page or blog post it’s inserted into.
Some themes don’t follow this practice and as a result, when you Export blog posts from WordPress EVEN when using the above plugin to Export images with blog posts in WordPress – the images won’t come with the posts.
You can “Manually” attach the images to your posts – but this is actually quite a bit of manual work…
It might actually be worth switching themes to gain the functionality – go through and re-save each post and the images SHOULD now be attached. (A default WordPress theme will do the trick)
#2 – The site you’ve Exported Posts & Images from isn’t live / accessible via the web at the point you’re importing the posts into the new site
OK, so there was an asterisk above when I said that the WordPress Exporter exports the images with the posts. It actually only exports a file location.
The importer then goes to that file location (accessible via the web), downloads the file and uploads it to your media library (the exact technicalities of how it works are unimportant, that’s a bit of simplification).
This means that if you’ve:
- Exported WordPress Posts “with images” from a “development site” or some temporary website
- Then taken down the “development site”
- Then later Imported WordPress Posts “with images” to the “Live site”
- The Importer won’t be able to access the images that you’d originally “exported” as you only exported a file location
This is common when working on building a new website and then switching the DNS A records to switch one site “off” whilst making the new site live.
It is possible to build a new WordPress site while the old site is live – which I covered in this article explaining the process of building a new WordPress website while the old site was live.