By Farhan Munim Updated WordPress Cloudflare 2 min read

How I successfully export media with selected (post) content

If your WordPress posts import fine but media doesn’t, Cloudflare might be blocking it without telling you.

I rebuild my WordPress site fairly often. I like starting clean, but I always want to keep my posts and media.

This time around, I tried to do things properly and use a plugin to export posts with their media instead of relying on manual workarounds.

The posts imported fine.
The media didn’t.

WordPress import screen listing multiple media files that failed to import

If you’ve run into the same issue – especially when Cloudflare is involved – this is what actually fixed it for me.

The setup

No obvious PHP or WordPress errors. Just missing attachments.

What wasn’t the problem

Before getting anywhere useful, I ruled out the usual suspects:

  • PHP memory limits
  • Upload and download limits
  • Execution timeouts
  • Plugin configuration

None of these made any difference. If you’re seeing posts come across but media fail silently, this is a good sign the issue is elsewhere.

Testing the real failure point

At this point, the important question was simple:

Can the new server actually download media files from the old site?

To answer that, I built a small test media URL plugin on the destination site that attempts to fetch a single media URL from the old site and reports the response code.

The result was consistent: 403 Forbidden.

Test Media URL Access tool reporting a failed request with a 403 Forbidden response

That ruled out WordPress entirely. The request wasn’t even getting through.

Cloudflare and automated requests

Looking at the response headers made it clear Cloudflare was blocking the request.

I tried:

  • Enabling Development Mode
  • Bypassing cache

Neither helped.

What did work was whitelisting the destination server’s IP address in Cloudflare on the old site.

Cloudflare WAF Tools page showing IP Access Rules set to Allow

As soon as I did that:

  • The test request returned 200 OK
  • Media files downloaded successfully
  • The import completed as expected
Test Media URL Access tool showing a successful 200 response after the Cloudflare configuration change

Why this happens

Media import plugins don’t “copy” files directly. They make HTTP requests from the new site to the old one.

From Cloudflare’s perspective, this can look like:

  • Automated traffic
  • Scraping
  • Or a potential abuse pattern

So the requests get blocked…quietly.

Once the server IP is trusted, the imports work normally.

WordPress import completion screen confirming posts and media were imported successfully

What to check if your media imports keep failing

If you’re stuck with missing media during a WordPress migration:

  • Test media URLs directly from the destination server
  • Check HTTP status codes (403 is a big clue)
  • Review Cloudflare firewall and security settings
  • Temporarily whitelist the destination server IP
  • Retry the import

In my case, the plugin itself was doing exactly what it was supposed to do.