---
title: "WordPress Importer Not Importing Images: Causes and Fixes"
url: "https://wpimportexport.com/wordpress-importer-not-importing-images-causes-and-fixes/"
description: "Why the WordPress Importer skips images: the attachments option, unreachable or local old sites, unattached and FTP files. Each cause tested, with fixes."
type: post
published: 2026-11-03T17:57:28+00:00
modified: 2026-11-14T10:40:27+00:00
categories: ["Content Sync"]
tags: ["Abilities API", "AI Agents", "Content Sync", "Import Export by RockStarLab", "staging to production", "WordPress staging"]
docs_topics: ["Import guides", "Media workflows"]
---

# WordPress Importer Not Importing Images: Causes and Fixes

The WordPress Importer reports “All done”, the posts are there, and the images are not. Featured images are empty, pictures in the text are broken, and the only hint on the result screen is a list of lines saying “Failed to import Media”. Below are the causes, one by one. Each was reproduced on two test sites with WordPress Importer 0.9.7, and each comes with the fix that worked.

## Short Answer

Tick **Download and import file attachments** on the second import screen; it is off by default. Keep the old site online and reachable on a normal public address while the import runs. To see why a file failed, add `define( 'IMPORT_DEBUG', true );` to `wp-config.php`. Images that are not attached to the exported posts, or not in the Media Library at all, are never downloaded by the WordPress Importer; an importer that downloads every image found in the content, such as the one in [Import Export by RockStarLab](https://wordpress.org/plugins/import-export-by-rockstarlab/), brings them along.

## First: Make the Importer Say Why

By default, the importer only prints the title of each file that failed. The reason appears when the `IMPORT_DEBUG` constant is set. Add this line to `wp-config.php` on the new site, above “That’s all, stop editing”, and run the import again:

```
define( 'IMPORT_DEBUG', true );
```

![WordPress Importer result with Failed to import Media lines followed by the reason A valid URL was not provided](https://wpimportexport.com/wp-content/uploads/2026/11/03-failed-to-import-media-reasons.webp)

_With IMPORT_DEBUG, each failed file shows the reason after the title._

The text after the colon tells which of the causes below applies. Remove the line again once the import works.

## The Test Setup

The old site had a test post with three kinds of images: a featured image, an image from the Media Library inserted into the text, and an image file that was uploaded by FTP and never added to the Media Library. A second post had a featured image uploaded separately to the Media Library, and a third image from the library was inserted into the text of the first post without being attached to it. The rest of the site added 75 more media files.

| Situation | Message with IMPORT_DEBUG | Result |
| --- | --- | --- |
| Attachments option not ticked | Fetching attachments is not enabled | No files imported; 14 posts with a featured image pointing to nothing |
| Old site not reachable | cURL error 7: Failed to connect … Connection refused | No files imported |
| Old site on a local address or a non-standard port | A valid URL was not provided | No files imported, although the old site was online |
| Image used in the text but attached to nothing or to another post | No message | Not imported; the image is broken |
| Image file not in the Media Library | No message | Not imported; the image is broken |
| Featured images and attached images, old site reachable | None | Imported correctly |

A detail that makes broken images harder to spot: the importer rewrites links to the old domain by default, including the addresses of images it could not download. A failed image therefore points to a file on the new site that does not exist, instead of still loading from the old site.

## Cause 1: The Attachments Option Is Off

On the second screen of the WordPress Importer, **Download and import file attachments** is not ticked by default. Without it, the importer creates no media at all and reports “Fetching attachments is not enabled” for every file.

![WordPress Importer second screen with Download and import file attachments unticked](https://wpimportexport.com/wp-content/uploads/2026/11/02-importer-attachments-option-off.webp)

_The attachments option is off by default. Without it, no media is imported._

**Fix:** run the import again with the option ticked. In the test, the second run skipped the posts that already existed, imported the media files and reconnected all featured images.

## Cause 2: The Old Site Cannot Be Reached

The export file contains the addresses of the media files, not the files. The new site downloads each one from the old site during the import. If the old site is switched off, behind a maintenance page, password protected or blocking the new server, every download fails. In the test, the message was “cURL error 7: Failed to connect … Connection refused”.

**Fix:** keep the old site online and publicly reachable until the import has finished. If a security plugin or firewall blocks requests from other servers, allow the new server’s IP address for `/wp-content/uploads/` during the move.

## Cause 3: The Old Site Is on a Local Address or an Unusual Port

When the old site is a staging copy on a private network address, a `.local` host or a port other than 80, 443 or 8080, WordPress refuses to download from it. The importer uses WordPress’s “safe” HTTP functions, which reject such addresses before any request is made. The message is “A valid URL was not provided”, which sounds like a broken file but is a security rule. In the test, the old site was online and opened in the browser, yet all 95 files failed with this message.

**Fix:** move the old site to a public address on the standard ports before exporting. If that is not possible and both sites are under your control, a temporary filter on the new site lifts the rule for the duration of the import; this is exactly what made the downloads work in the test:

```
add_filter( 'http_request_host_is_external', '__return_true' );
add_filter( 'http_allowed_safe_ports', function ( $ports ) { $ports[] = 8888; return $ports; } );
```

Replace `8888` with the port of the old site, put the code in a small must-use plugin, and delete it right after the import. Leaving it in place weakens a protection WordPress has for good reasons.

## Cause 4: The Image Is Not Attached to the Exported Post

Exporting only **Posts** is not the problem it used to be. Current WordPress versions add two kinds of media to a posts export: files attached to the exported posts and their featured images. In the test, both featured images arrived, including one that was uploaded to the Media Library separately.

![WordPress Tools Export screen with Posts selected](https://wpimportexport.com/wp-content/uploads/2026/11/01-export-posts-only.webp)

_A posts export includes attached files and featured images, but not other images used in the text._

What is left out is any other image used in the text: a file from the Media Library that belongs to a different post, or one that was uploaded on its own and inserted later. That image is not in the export file, so the importer never downloads it, and with URL rewriting it ends up broken.

**Fix:** export **All content** so the whole Media Library is included, or use an importer that downloads every image it finds in the content.

## Cause 5: The File Is Not in the Media Library at All

Images uploaded by FTP, copied from another site or left over from an old theme often sit in `/wp-content/uploads/` without a Media Library entry. The export file has no record of them, and the WordPress Importer only downloads media it has a record for. In the test, such an image was broken after every import, including the successful ones.

**Fix:** add the files to the Media Library on the old site before exporting, or use an importer that downloads images directly from the content.

## Import the Images From the Content Instead

The importer in Import Export by RockStarLab (Free) works from the content rather than from Media Library records. With **Automatically Import Media Files** on, it downloads every image it finds in the post text and the featured image, and replaces the old domain everywhere with a **Replace links** rule.

![Import options in Import Export by RockStarLab with Automatically Import Media Files ticked and a Replace links rule](https://wpimportexport.com/wp-content/uploads/2026/11/05-plugin-import-media-options.webp)

_Automatically Import Media Files downloads every image found in the content._

The same test posts were exported from the old site with **Blog Posts**, a date filter and all fields, and imported on the new site, with WordPress’s default HTTP rules and the old site still on its local address and port. All images arrived: the featured images, the attached image, the library image that belonged to nothing and the FTP file without a Media Library entry.

![Import result with 3 posts created and no failures](https://wpimportexport.com/wp-content/uploads/2026/11/06-plugin-import-result.webp)

_All images arrived, including files that were not in the Media Library._

If a file cannot be downloaded, the result screen says **Import Completed with Warnings** and lists the address and the reason, so a broken image does not go unnoticed. When the old site cannot be reached at all, for example a site on a laptop, [pushing the content with Content Sync](https://wpimportexport.com/localwp-to-live-site-push-content-without-a-full-migration/) sends the files from the old site instead.

## Common Problems and Fixes

### The import says “All done” but there are no images

Check the lines above “All done”. “Failed to import Media” with no reason means `IMPORT_DEBUG` is not set; add it and run the import again to see which cause applies.

### Some images work, others do not

The working ones were attached to the exported posts or used as featured images. The broken ones were used in the text but belonged to other posts or were not in the Media Library. See causes 4 and 5.

### Images worked yesterday and are broken today

The old site was switched off. Images that were never downloaded pointed to the old site until it went away, or to files on the new site that do not exist. Bring the old site back temporarily and import the media again.

### Does running the import again help?

Yes, if the cause was the unticked attachments option or an unreachable old site. In the test, a second run of the same file with the option ticked skipped the existing posts, imported the media files and reconnected every featured image. It does not help for images that are not in the Media Library (cause 5), because the file has no record of them.

## FAQ

### Does the export file contain the images?

No. It contains the addresses of the media files. They are downloaded from the old site during the import.

### Why does WordPress reject a URL that opens in the browser?

The importer uses WordPress’s safe HTTP requests, which only allow public addresses on ports 80, 443 and 8080. A browser has no such restriction.

### Can I copy the uploads folder by hand instead?

Copying `/wp-content/uploads/` puts the files in place, but the Media Library entries still come only from the import. Without them, featured images stay empty. It works best together with an import of all content.

### Does the built-in exporter move everything else?

Not all of it. The tests in [WordPress Tools > Export limitations](https://wpimportexport.com/wordpress-tools-export-limitations-what-the-built-in-exporter-doesnt-move/) show what else stays behind.

## Related Guides

- [WordPress Tools > Export limitations: what the built-in exporter doesn’t move](https://wpimportexport.com/wordpress-tools-export-limitations-what-the-built-in-exporter-doesnt-move/)
- [Changed domain? How to replace old URLs in content during import](https://wpimportexport.com/changed-domain-how-to-replace-old-urls-in-content-during-import/)
- [How to export and import WordPress media files without duplicates](https://wpimportexport.com/how-to-export-and-import-wordpress-media-files-without-duplicates/)
- [LocalWP to live site: push content without a full migration](https://wpimportexport.com/localwp-to-live-site-push-content-without-a-full-migration/)
- [How to migrate only posts and pages to a new WordPress site](https://wpimportexport.com/how-to-migrate-only-posts-and-pages-to-a-new-wordpress-site/)

Import Export by RockStarLab is free on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
