I have used Tools->import&export but it didn't work. I have tried using Wp-All-Import and Export plugin then also it is not working. Only the content imported not the images. How to fix this issue. Is there any way to import posts with images?
Why images don't get imported
It's the export step that causes the issue here with image attachments. WordPress’ export function doesn’t include the “attachment” post type unless you select the “All content” export option. But if you only want to import and export your posts from one site to another, you lose your attachments. There is more information about the why of this here.
How to get images into your new website anyway
So if you're only exporting and importing posts, one option is to move your images manually. But that's potentially a lot of work, especially on larger sites. The other option is to import you posts without the images, and then use the Auto Upload Images plugin to add the images afterwards. This plugin does several things:
- It looks for image URLs in your posts (imported posts do still have image URLs in them, but they point to the site the content was exported from);
- It then gets those external images and uploads them to the local WordPress uploads directory and adds the images to the media library;
- And finally, it replaces the old image URLs with new URLs.
The process is semi-automatic and relatively quick. You can uninstall the plugin again when you're done, so you're not left with an extra plugin on your website. Using the plugin for this purpose isn't explicitly documented in the plugin's documentation, so here is a step-by-step guide.
Step by step: Importing posts and images from one website into another with the WordPress Importer and Auto Upload Images plugin
Step 1: Prepare your export file on the old site
On your old website go to 'Tools > Export' and export your posts only.
Step 2: Import your posts into the new site
On your new website go to 'Tools > Import' and import the posts you exported. The importer has an option to download and import file attachments, but this won't work if you're not migrating all content, so you can ignore this.
Step 3: Install and activate the Auto Upload Images plugin
It installs as any other plugin in the WordPress repository. Once activated the plugin adds a settings page under 'Settings > Auto Upload Images', but in my experience you can leave these to their defaults.
Step 4: Get the image from your old site into your new site
At the time of writing the plugin has no option to automatically go through your posts and bulk upload plus update all the images. Instead, it updates each post individually when you save it. If you have many posts this is a lot of work, but there is a little trick. You can go to your posts overview screen and bulk update your posts. There is a little more information on this here (useful note on multisite).
Essentially, you select multiple posts and then under 'bulk actions' choose 'edit' and press the 'apply' button. Then, without making any adjustments, click the 'Update' button. Depending on your server you may get a timeout as the process runs, so it's a good idea to do this maybe 20 to 50 posts at a time.
Step 5: Check your posts and deactivate/uninstall the plugin
When all is done you can check your posts and confirm they now reference local images. You then no longer need the plugin and you can safely deactivate and delete it.
Probably a good idea to make a backup of your new site first (at least of your site's database).
At the time of writing the Auto Upload Images plugin hasn't been updated for quite some time, but on testing it worked fine.
With this method all images in posts get imported, not just featured images.
Use Export Featured Images plugin that let you export Featured images from posts or custom post types into a WordPress xml so you can import them in other sites using the WordPress importer tool.
How to use??
- First, import your posts to the new site.
- Use this plugin in your old site and go to under tools > Export Featured Images and select post types. Then you will get a .xml file.
- In your new site go to Tool and select wordpress import. Then select the .xml file which you downloaded in the previous step.
That’s all.. Your posts are mapped with featured images. Enjoy!
I am the best person to answer this question as I was facing the same issue while importing. The problem is not actually in importing.
It is in exporting. When you export all content then you import with attachments that XML file all your images will be download but when you export selected posts then import with attachments then only posts get imported. So to fix this there is a plugin which exports the right XML file that it does same like export all content XML file.
So here is the plugin https://wordpress.org/plugins/demomentsomtres-wp-export
This will create a new export option just like default WordPress export GUI, but with advanced features so that when you import that XML file your media will be imported while importing that XML file(from default server to your local server). You don't need to install it in the Wordpress where you importing media, It just needs to be installed on the exporting server WordPress.
That did the trick for me. All other options didn't work, but that plugin finally did what I needed!
I had to export real estate properties from one site to another. Each property has a lot of images. This plugin https://wordpress.org/plugins/demomentsomtres-wp-export did exactly what I needed - downloaded and uploaded all the images from the first site to the second.
There are multiple ways you can do this:
- Using plugin
For manual, it's a little more lengthy process, you need to download complete files from one server and upload it to another. Do some changes to the backup DB i.e replacing urls and then uploading the DB file as well.
Other way, which is far more better is to use the plugin called as "All in one Migration". Here is the link which can guide you on the complete process:
I just found out how to do this today, and answered this question with a great guide with photos on how to use the export and import tools in WordPress to transfer photos to a new site to be used in posts and pages. This is done by editing the xml files to show the correctly transferred image URLs.