34

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?

6
  • see this article here, they mentioned how can you import/export featured images Commented Feb 20, 2017 at 13:21
  • 2
    How many posts do you need to import export? the thing is, you can use WP default import export and just leave to do it's work, It will take a while for the images to get imported so give it time. Option B would mbe to export /import all media files and then proceed with posts. Commented Feb 20, 2017 at 13:26
  • 1
    Hi.. Not only featured images. All images in post are not importing. Commented Feb 22, 2017 at 6:19
  • 1
    @ArsalanMithani that article only talks about featured images in WooCommerce product images
    – clayRay
    Commented Aug 6, 2020 at 8:01
  • I found this helpful. The default settings pretty much work. wordpress.org/plugins/wp-import-export-lite Commented Nov 5, 2020 at 19:29

8 Answers 8

37

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.

Bulk-updating posts

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.

Final thoughts

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.

4
  • 1
    Great answer. Works perfectly.
    – Chris
    Commented Jan 22, 2019 at 16:53
  • This didn't work for me.
    – shipshape
    Commented Jun 5, 2019 at 15:42
  • 2
    Images in post worked, featured images did not.
    – gmatta
    Commented Jun 9, 2020 at 17:57
  • 1
    Worked great with WP 5.4.2 - love the bulk edit solution!!
    – pathfinder
    Commented Aug 6, 2020 at 18:43
18

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.

https://wordpress.org/plugins/export-featured-images/#description

How to use??

  1. First, import your posts to the new site.
  2. 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.
  3. 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!

13
  • 1
    It's not been updated for a while but works just fine with Wordpress 5.2.2. Life saver!! Why this level of functionality is not in core I really do not know.
    – Chris Pink
    Commented Jun 19, 2019 at 7:42
  • 1
    @ChrisPink Are you checking "Import media attachments" at both step 1 and 3, or just step 3?
    – Jonny
    Commented Jun 19, 2019 at 14:56
  • 2
    Both steps 1 and 3.
    – Chris Pink
    Commented Jun 20, 2019 at 15:23
  • Unfortunately this plugin seems to have been removed from the WP repository.
    – clayRay
    Commented Sep 5, 2019 at 2:06
  • 2
    Tested export with WordPress 5.2.5 and tested import with WordPress 5.2.4, worked like a charm!
    – Ken
    Commented Mar 6, 2020 at 15:55
4

I´ve tried mentioned plugins and "DeMomentSomTres Export" - worked on featured images + some but not all regular images and "Auto Upload Images" - worked on all regular images but not on featured images. If you combine the two of them problem would be solved but not ideal to have two plugins for the same purpose. Instead i found another plugin that worked like a charm:

"Export Media with Selected Content"

Only needed on exporting site, the importing site can use the regular importer. Worked for me and ALL images were included.

1
  • +1 "Export media with selected content" works great
    – Gavin
    Commented Mar 14, 2022 at 17:21
2

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.

2

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.

0

There are multiple ways you can do this:

  • Manual
  • 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:

https://makersbyte.com/easily-export-import-wordpress-sites/

0

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.

Failed to import Media

-1

there is a very simple way to do it. When you are export your posts from Wordpress via WORDPRESS IMPORTER plugin.


steps


1- download XML Posts File.

2- Edit your XML posts file, now replace your old website url's with new website url's in editor(notepad or any other).

3-make sure your old url is replaced with new in downloaded XML file, save it.

4- now import this edited file in your new Wordpress website.


that's it.

all done

you can easily did this with replacing url in XML file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.