Broken images after a WordPress import usually have one of three causes: the stored URL still points to the old domain or folder, the referenced file never reached the new wp-content/uploads directory, or WordPress is requesting a thumbnail size that does not exist. Diagnose which case you have before changing anything.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
Back up the database and files, confirm the new WordPress and Site addresses, then use a serialization-aware URL replacement for stale links. Restore missing attachments separately, regenerate missing derivatives when originals exist, and verify the rendered site—including responsive image variants—after caches are cleared.
As an Amazon Associate I earn from qualifying purchases.
Identify what is actually broken
Open a page containing a broken image and inspect its HTML or the browser’s Network panel. Record the complete requested URL, the HTTP response, and whether the URL is for the original file or a resized derivative. A 404 usually means the path or filename does not exist; a 403 or similar response points to permissions or server access; a successful response with an unexpected image can indicate a stale cache or a wrong file at that path.
The URL still names the old location
Imported post content can retain the former domain, a previous subdirectory, a CDN hostname, or an old protocol. For example, content may still request https://old.example/wp-content/uploads/2023/09/photo.jpg after the site moved to https://new.example/. WordPress’s migration guidance notes that existing media links continue to refer to the old folder until they are updated.
#1 Best Overall
- Slim durable design to help take your important files with you
- Vast capacities up to 6TB[1] to store your photos, videos, music, important documents and more
- Back up smarter with included device management software[2] with defense against ransomware
- Help secure your important files with password protection and hardware encryption
- 3-year limited warranty
The file is absent or unreadable
A database replacement cannot create a file that was not copied. Check the destination filesystem for the exact path under wp-content/uploads, including year/month folders and letter case. Also check that the web server can read the file. If the original was deleted, skipped during transfer, or re-uploaded under a different name, you must restore or re-import the attachment rather than only editing URLs.
Only a resized derivative is missing
WordPress often embeds a generated filename such as photo-300x200.jpg while the original photo.jpg is present. This is a different failure from a missing original. Regenerating registered image sizes can recreate the derivative without editing every post.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Responsive markup requests another variant
A page may display correctly at one viewport but fail at another because its srcset candidate is missing. Inspect every requested URL, not just the first image you see. Featured images, custom post types, and media embedded in widgets can have different stored paths from ordinary post content.
Use a triage decision before editing
| What you find | Likely cause | Correct repair |
|---|---|---|
| The URL contains the former domain, folder, CDN host, or protocol, and the equivalent file exists on the new site | Stale URL stored in content or settings | Run a serialized-data-aware search-and-replace, then test the rendered pages |
| The URL is already canonical, but no corresponding file exists in uploads | Upload was not transferred, was deleted, or was renamed | Copy the file or import it as an attachment; then update the content that needs it |
The original exists, but a name ending in dimensions such as -300x200 returns 404 |
Missing or stale generated size | Regenerate the registered sizes, or replace the attachment if the source file is wrong |
| The file exists but requests fail with an access response | Unreadable file or server rule | Correct ownership and permissions or the relevant server rule before changing database URLs |
| Files work after a change only for some visitors | Page, object, or CDN cache still serves old markup | Clear the applicable caches and repeat the network check |
Back up before touching URLs or attachments
Keep independent copies of the database and the WordPress files, especially the entire uploads directory. Store the copies separately from the live host so a mistaken replacement or failed transfer does not remove your recovery path. An external drive or other separate storage is appropriate for this one-time safety copy.
- Export the current database using your host’s backup facility or a command such as
wp db export before-image-repair.sql. - Copy the complete WordPress files and
wp-content/uploadsdirectory to separate storage. Do not rely on a backup that lives only on the destination server. - Write down the old and new scheme, host, and path, for example
https://old.example/blogandhttps://new.example/. Include any CDN hostname that appears in the broken URL. - Record the tables or content types you intend to change. A narrow first pass is easier to review than an unbounded replacement.
An incorrect search or replacement string can damage database content, so do not skip the backup even if the change appears to be a simple domain swap.
Confirm WordPress’s canonical addresses
In the dashboard, open Settings → General and check both fields:
Free tools Windows power users keep installed
One-click scans. No signup required.
- WordPress Address (URL) is where the WordPress core files are installed.
- Site Address (URL) is the public address visitors use.
When a site moves from a subdirectory to the document root, these values must reflect the new location. Existing media links can still contain the old folder even after the two settings are corrected, which is why a separate content replacement is often required.
Rank #2
- Slim durable design to help take your important files with you
- Back up smarter with included device management software[2] with defense against ransomware
- Help secure your important files with password protection and hardware encryption
- 3-year limited warranty
If you cannot reach the dashboard during the migration, a temporary definition in wp-config.php can establish the new addresses while you repair the database:
define( 'WP_HOME', 'https://new.example' );
define( 'WP_SITEURL', 'https://new.example' );
Use the new values only long enough to perform the planned repair. Remove the temporary constants after the database contains the correct addresses, then save the permalink settings in the dashboard if WordPress asks you to refresh rewrite rules.
Replace old image URLs safely
WP-CLI workflow for SSH access
WP-CLI’s search-replace command understands serialized PHP data, which is important because WordPress options, widgets, and metadata can contain serialized arrays. Start with a dry run:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →wp search-replace 'https://old.example' 'https://new.example' --dry-run
Review the reported tables and counts. For a controlled migration, name the tables you intend to edit and leave the guid column out of the replacement:
wp search-replace 'https://old.example' 'https://new.example' wp_posts wp_postmeta wp_options --skip-columns=guid
The exact table list depends on your installation. A multisite network can use the command’s network mode so each site’s tables are considered; do not use a network-wide operation on a single-site installation by accident. WP-CLI also supports exporting the replacement SQL for review instead of applying it immediately:
wp search-replace 'https://old.example' 'https://new.example' --skip-columns=guid --export=/tmp/url-rewrite.sql
Run the replacement only after checking the dry-run output and the old/new strings character by character. If the old site used a subdirectory, search for the complete old base, such as https://old.example/blog, rather than replacing only the hostname and leaving a stale /blog path behind. If images came from a separate CDN, perform a deliberate replacement for that hostname as well.
Dashboard workflow when SSH is unavailable
Better Search Replace provides a dashboard-based route. Its documented sequence is:
Rank #3
- High-capacity external hard drive with up to 2TB of storage The ModusTech Facet portable external hard drive gives you dependable HDD storage in a slim 2.5-inch design. Multiple capacities available up to 2TB — back up photos, videos, music, documents, and game libraries with room to grow. A trusted external storage solution for everyday backup, media archives, and creative work.
- USB-C and USB 3.1 connectivity with included 2-in-1 cable The Facet ships with a USB-C to USB-C cable and tethered USB-A adapter, so this external hard drive connects to modern laptops, USB-C iPhones, tablets, and older USB-A computers without buying an extra cable. USB 3.1 Gen 1 (5Gbps) interface delivers real-world transfer speeds up to 100MB/s — fast enough to back up 50GB of files in about 8 minutes.
- Plug-and-play external hard drive for PC, Mac, and laptops Preformatted in exFAT and ready to use the moment you plug it in. The Facet works out of the box with Windows PCs, macOS Macs, MacBooks, Chromebooks, and laptops — no drivers, no software, no setup required. A true plug-and-play external hard drive built for everyday use across every major operating system.
- External hard drive for PS4, Xbox One, and Smart TV gaming The Facet is compatible with PlayStation 4, Xbox One, and Smart TVs with USB support. PS4 and Xbox One games run directly from the drive — plug it in, format through the console, and add to your storage. Also works with Smart TVs that support USB recording or external media playback.
- Slim, shock-resistant portable external hard drive — 160g At 2.5 inches and just 160g, this portable external hard drive is bus-powered through a single USB-C cable — no separate power adapter, no extra cables. Slim enough for a laptop bag, jacket pocket, or camera bag, with a shockresistant casing and faceted diamond-texture top panel that resists fingerprints and everyday wear. Backed by a 1-year limited warranty from ModusTech, a consumer electronics brand specializing in external storage.
- Back up the current database and uploads.
- Install the plugin on the destination site.
- If the site URL is not yet stable, define the new address temporarily in
wp-config.phpwithWP_HOMEandWP_SITEURL. - Enter the old URL as the search value and the new URL as the replacement value, select the intended tables, and run the tool’s preview or dry-run facility if offered by your installed version.
- Apply the replacement only after verifying the strings and table selection.
- Remove the temporary constants and resave Settings → Permalinks if links still use old rewrite rules.
Do not paste an old URL with a trailing slash in one field and a value without it in the other unless you have intentionally planned for both forms. Check protocol, hostname, port, and subdirectory as separate parts of the string. A replacement that fixes post bodies but misses options or widget metadata can leave menus, featured images, or sidebars broken, so include the tables that actually contain those values.
Why blind SQL replacement is risky
Serialized values include lengths that must match the stored string. Changing a URL with an ordinary SQL REPLACE() can leave invalid length data and break options or widgets. Use WP-CLI or a tool that explicitly handles serialized data, and keep the untouched export until every part of the site has passed verification.
Restore attachments that never arrived
Check the destination before importing
Compare the broken URL’s path with the destination filesystem. Check the month and year directory, filename case, and extension. A file named IMG_1234.JPG is not interchangeable with img_1234.jpg on a case-sensitive server. Confirm that the web server account can read the file and that no access rule blocks the uploads directory.
If the original file is present under another name, do not create a second attachment unnecessarily. Replace the attachment file while preserving its identity, then regenerate sizes. If no usable copy exists, obtain one from the old host or a known backup before changing post content.
Recommended Free Tools
Import a local file or URL with WP-CLI
wp media import creates a WordPress attachment from a local file or a reachable URL. A local example is:
wp media import /path/to/photo.jpg
After import, check the Media Library for the new attachment and its generated metadata. If the imported file is meant to replace an existing attachment, use the attachment-replacement command rather than leaving posts pointing to a disposable duplicate:
wp media replace <attachment-id> /path/to/photo.jpg
Keep the attachment ID when possible. Existing featured-image assignments and metadata then continue to reference the same media item, while the file and generated sizes are rebuilt from the replacement source.
Rank #4
- No wall warts: Work freely with its bus-powered USB-C. No wall outlet required.
- Big on space: High-capacity storage to store all your files in one place.
- Reliable backup: Safeguard assignments, projects, or sensitive files with trusted performance.
- Fuss-free, clutter-free: One port, one cord, quick connect.
- Peace-of-mind: Comes with two-year limited warranty and Rescue Data Recovery Services.
Use WXR import options when repeating the migration
For a WordPress eXtended RSS (WXR) import, the importer can rewrite links that still point to the previous site:
wp import export.xml --rewrite_urls
If matching files are already in a local uploads directory, provide that directory so the importer can reuse them instead of treating every item as absent:
wp import export.xml --source-dir=/path/to/wp-content/uploads
These options address different problems: --rewrite_urls changes imported references, while --source-dir supplies local files for matching attachments. Neither option can recover a file that does not exist in the source directory or at the original URL.
Regenerate missing thumbnails and other derivatives
Use regeneration when the original attachment is present and the missing URL follows a registered size pattern. First list the sizes configured by the site:
wp media image-size
Then regenerate the derivatives. To create only sizes that are absent, use:
wp media regenerate --only-missing
A full regeneration is appropriate when image-size settings changed or several sizes are inconsistent:
wp media regenerate
Regeneration does not repair a wrong domain in post content, and it cannot work without a readable original. Conversely, editing every post by hand is unnecessary when the attachment and the registered size still exist; rebuilding the derivative is the cleaner repair.
Best Value
- USB-C and USB 3.1 compatible.Specific uses: Business, personal
- Innovative style with refined metal cover
- Password protection with 256-bit AES hardware encryption
- Formatted for Mac
If the source image itself is damaged or has been replaced, use wp media replace <attachment-id> /path/to/new-file.jpg first, then regenerate. Check available disk space before a large regeneration because WordPress may create several files per original.
Verify the rendered site, not just the database
- Open representative posts and pages from different publication dates.
- Check custom post types, archive pages, widgets, and navigation areas that may store media separately.
- Test featured images and images inserted through the block editor or a page builder.
- Resize the browser or use a mobile viewport so every
srcsetcandidate is requested. - In the browser’s Network panel, filter for image requests and confirm that expected responses are successful rather than 404 or access errors.
- Clear page caches, object caches, and CDN caches after the replacement or regeneration. Recheck in a private window or an uncached session.
- Search the rendered HTML and database for the old hostname or folder after the main repair, then investigate any remaining matches instead of replacing them blindly.
There is no universal success-rate statistic for these repairs. A migration is complete when the files, attachment metadata, stored URLs, generated sizes, and cached output all agree on the new location.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallChoose the least destructive repair
| Situation | Preferred method | Reason |
|---|---|---|
| You have SSH and need a repeatable, reviewable migration | WP-CLI search-replace with --dry-run, an explicit table list, and serialized-data handling |
It provides command-line previews, SQL export, and network-aware operation |
| You have dashboard access but no SSH | Better Search Replace after a database backup | It supplies a guided dashboard workflow for replacing old and new URLs |
| The destination file exists but content names the old host | URL replacement | The problem is a stale reference, not a missing attachment |
| The destination file does not exist | Copy or import the attachment, then update references as needed | A database edit cannot manufacture missing binary data |
| The original exists but a generated size is absent | Thumbnail regeneration | It recreates the derivative without editing every post |
| The source file is wrong or unusable | Replace the attachment file while retaining its ID, then regenerate | Existing featured-image and metadata relationships remain intact |
Common failure patterns and their fixes
Only some old URLs were replaced
Run a read-only search for each old hostname, protocol, and subdirectory. A site can contain both http:// and https://, or both a CDN host and the origin host. Plan separate replacements for genuinely different bases, and review remaining matches before each run.
The home page works but imported posts do not
The home page may use a theme option or a newly uploaded logo, while imported post bodies still contain absolute old URLs. Include wp_posts and relevant metadata in the replacement and test older posts, not only the front page.
The database is fixed but images still 404
Inspect the exact new path on disk. If the file is absent, restore it; if only the derivative is absent, regenerate it. If the file exists, check case, permissions, server rules, and caches before running another database replacement.
Regeneration creates files, but the page requests a different name
The requested size may no longer be registered, or post content may contain a stale hard-coded filename. List registered sizes, compare the requested dimensions with those definitions, and update the content only when the original attachment and size configuration cannot produce the requested file.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
A temporary URL constant causes confusing redirects
Make sure WP_HOME and WP_SITEURL use the same intended scheme, host, and path. Once the database is corrected, remove the constants and save permalinks so the permanent settings—not a temporary override—control the site.
Quick Recap
Final checklist
- Database export and independent file/uploads backup completed.
- WordPress Address and Site Address show the canonical destination.
- Old domain, folder, CDN, and protocol forms identified.
- Search-and-replace preview reviewed before applying changes.
- Serialized data handled by WP-CLI or a serialization-aware dashboard tool.
- Missing originals restored or imported as attachments.
- Registered derivatives regenerated when originals exist.
- Featured images, custom post types, widgets, and responsive
srcsetURLs tested. - Page and CDN caches cleared, followed by a second network-panel check.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




