Use 1 WordPress-aware database search-and-replace pass, then check 3 places—post content, builder fields, and canonical/media URLs. The real fix for how…
Last updated: November 28, 2026
Quick Answer: use 1 WordPress-aware database search-and-replace pass, then check 3 places—post content, builder fields, and canonical/media URLs. The real fix for how to update hardcoded URLs and embedded references after a WordPress move is to update post content, builder fields, shortcodes, and any embedded references that still point to the old domain, while protecting serialized data so you do not break layouts or settings.
Key takeaways
- Hardcoded URLs can hide in post content, widget fields, shortcodes, and page builder data.
- A plain “find and replace” in the database can damage serialized data if the tool does not understand it.
- Relative URLs can need a separate pass from absolute URLs, because they may not show the old domain in the same way.
- Canonical tags and media links matter after a move, because they can keep signaling the old site address.
- A staged cleanup is common: back up first, replace second, then check a few posts, pages, and builder templates by hand.
What counts as a hardcoded URL?
A hardcoded URL is any full web address typed into content, a field, or a builder setting instead of being generated by WordPress. That usually means https://oldsite.example/... sitting inside a post, a shortcode, an image link, a button URL, or a page builder widget.
This matters because WordPress does not rewrite every one of those references during a move. A normal export and import can move the post, but leave the old domain in places such as custom HTML, text widgets, theme options, and builder modules. If the site uses relative urls like /images/file.jpg, those may survive better, but they still need a check because they can point to the wrong path after folders change.
To update hardcoded URLs after a WordPress move, search for the old domain in the database and in exported content. Pay attention to areas that are not plain post text: shortcodes, custom fields, menu descriptions, and page builder tabs often carry links that are easy to miss. A reader who only edits the visible page content usually fixes part of the problem and leaves the rest behind.
This is also where a lot of generic advice fails. Telling someone to “update links in posts” does not cover builder data, and telling them to run a database replace without warning about serialized data can break content instead of repairing it. The goal is not just to remove the old domain string; it is to preserve the structure around it. For background, WordPress documents database search-and-replace through WP-CLI at developer.wordpress.org, and its site migration guidance also covers moving URLs in stored content at wordpress.org.
Which files and fields need a search?
The right place to search is the database, plus any exported content that still stores URLs in plain text. The main targets are post content, custom fields, shortcodes, page builder fields, widget text, and theme options. A quick pass over only wp_posts is not enough if the site uses a builder or stores embeds in post meta.
Use a search and replace tool that understands WordPress data, not a raw text editor on SQL dumps. WP-CLI has a dedicated search-replace command, and the WordPress ecosystem also has database tools that preserve serialized data when they replace strings. That detail matters because serialized arrays store length counts, and changing a URL by hand can throw those counts off.
Here is the core procedure to follow:
- Back up the database before any replace. A full backup gives you a rollback point if a field gets mangled. This is the step that saves you from a long restore later.
- List the old domain and the new domain exactly. Include the protocol if the site switched from
http://tohttps://, because those are different strings in content and settings. You want a precise old value and a precise new value. - Run a search and replace tool that supports serialized data. WP-CLI is built for this kind of job, and the command is documented by WordPress at developer.wordpress.org. The result should be a database where the old domain no longer appears in the places you targeted.
- Check post content and shortcodes first. Open a few posts that contain images, buttons, or embeds. These are common spots for hardcoded URLs and visible broken links.
- Inspect page builder fields and theme options. Builder data often keeps its own URLs inside nested fields. If the tool skipped a nested structure, you may still see the old domain in the frontend even when plain post content looks clean.
- Review relative urls separately. If some assets use relative paths, make sure the folder structure on the new site still matches. Relative links can need a sanity check.
- Re-save a sample of edited pages. Saving can trigger a builder or plugin to rewrite its own stored references. That helps confirm the new domain is now the active one in the page data.
The trade-off is simple: a safer tool can take a little more setup, but it protects the content structure. A rushed raw replace can be faster and still cost hours when a page builder or shortcode output breaks. This is the right place for caution, not speed.
How do shortcodes and page builders store URLs?
Shortcodes and page builders often store URLs inside nested fields, so they need more care than normal text content. A shortcode may contain a full image path, a gallery source, or a link parameter, and a builder module may store several URL fields in one JSON-like or serialized blob.
That means two posts can look the same on the front end and behave very differently in the database. One may hold a simple link in post content. The other may hide the same link inside a builder record that only a serialized-aware tool can update safely.
A plain text replace is risky here because it can change the character count inside serialized data. If that count no longer matches the stored string length, WordPress can fail to read the field cleanly. The visible result may be a blank section, a broken widget, or a module that no longer renders.
Because of that structure, the safer habit is to replace at the database level with a WordPress-aware tool, then spot-check a few known builder-heavy pages. If the site uses a page builder with its own library or global widgets, those areas deserve special attention because a single global item can affect many pages at once.
A useful rule: if the URL lives in an editor field you can see and edit directly, it is easier to fix. If it lives inside a nested builder record, it is more fragile and deserves a cautious tool. That is why “just search the posts table” is not enough for an auto blog with repeated templates, and why a builder or global setting can spread one stale URL across many pages.
How do I avoid breaking serialized data while replacing urls?
You avoid breaking serialized data by using a WordPress-aware search and replace tool and by never doing blind string edits inside the database. Serialized data stores both the value and its length, so changing oldsite.example to newsite.example in the wrong way can corrupt the field even if the new text looks correct.
The main rule is to let the tool recalculate lengths for you. WP-CLI’s search-replace command is designed for that task, which is why it is safer than a direct SQL replace for WordPress content. The WordPress support and developer docs also describe URL changes and database updates in the context of moving a site, which is the right frame for this cleanup.
A few habits help prevent damage:
- Do not edit serialized strings in a text editor. One small character shift can make the whole field unreadable.
- Do not replace one fragment at a time in a raw SQL script unless you know the data is plain text. The same domain may appear inside structured values that need length correction.
- Test on a copy of the database first if the site is large or heavily built. That gives you a safe place to check a few pages before touching the live site.
- If the site moved from
http://tohttps://, treat that as part of the replacement plan and confirm it with a WordPress professional if the site uses a complex stack. The WordPress migration guidance at wordpress.org and the WP-CLI command reference at developer.wordpress.org both support handling the URL change carefully.
This approach is not for someone who only wants a quick visual fix. It is for a site where content reuse matters and builder data must survive intact. The cost of being casual here is not a tiny typo; it is a page that stops loading the way it should.
What should I check after the replace?
You should check the visible page, the HTML source, and a few database-backed settings after the replace. A page that looks right in the editor can still carry an old canonical URL, an old media link, or an old embedded reference in the source code.
Start with the obvious places: a post with images, a post with a shortcode, and one page built with the site’s main builder. Then check the media library item URLs, the site’s canonical tags, and any embedded references in widgets or theme fields. If the site uses relative urls, confirm that the new folder path still resolves correctly for images and linked files.
The most common miss is embedded media. An image can appear on the page while still linking to the old domain in the attachment source or in custom HTML. A video or external embed can also keep an outdated reference if it was pasted as full HTML rather than inserted through the editor.
It helps to compare three things side by side:
| Area | What it can hide | Why it matters |
|---|---|---|
| Post content | Old absolute URLs in text and HTML | Readers see broken links or old domains |
| Shortcodes and builder fields | Nested references inside stored settings | A small miss can break a whole module |
| Theme options and widgets | Sitewide links, logos, and embed settings | One stale value can affect many pages |

This is also the point where many people realize the move is only half done. The content may be updated, but the site still signals the old location in one or two hidden places. That is why a final pass matters more than a single big replace.
What about canonical URLs and embedded media links?
Canonical URLs and embedded media links need a final review because they can keep pointing at the old address even after the content text is fixed. Canonical tags tell search engines which version of a page is preferred, so an old canonical can work against the new site address. Media links can keep loading, but they may still reference the old domain inside attachment URLs or embed code.
This is not the same task as setting up redirects, which belongs to another step in a move. Here the job is to make the content itself point cleanly to the new site. If a canonical tag, image source, or embed source still uses the old domain, it can look like the move is incomplete.
The clean-up is usually a mix of database replacement and manual review. Replace the old domain in content fields, then inspect the rendered source of a few representative pages. If the site uses a theme or SEO plugin that stores canonical settings separately, those settings may need a direct update in the plugin panel or its saved options.
The limitation is worth saying plainly: no automatic replace can be relied on to catch every reference on the first pass. Pages that are built from many layers, especially those with repeated modules, are the ones most likely to hide a stale link. That is why the best fix is a methodical one, not a single click.
If the site also needs a full migration checklist, this cleanup fits inside the broader process described in the hub on how to migrate an auto blog from one WordPress site to another. This page stays focused on the hidden URLs that survive a normal export and import.
What counts as a hardcoded url in wordpress content?
A hardcoded URL is a full address written directly into WordPress content or settings instead of being built by WordPress automatically. It can sit in post HTML, a shortcode, a widget, a builder field, or a theme option. If the old domain is typed into the data itself, it is hardcoded.
How do I avoid breaking serialized data while replacing urls?
Use a WordPress-aware search and replace tool that understands serialized data and recalculates string lengths. Do not edit serialized values with a raw text replace or a manual SQL find and replace. If the site is large, make a backup first and test the replace on a copy of the database before touching the live site.
How many pages should I spot-check after a WordPress move?
Check at least 3 pages: one normal post, one builder-heavy page, and one page with images or embeds. That gives you a fast sample of the most common URL storage types.
What should I look for in the page source?
Look for 3 things: the old domain in links, the old domain in image sources, and the old domain in canonical tags. Those are the most common places stale URLs survive after a move.
Do relative URLs always need replacement?
No. Relative URLs often survive a move, but they still need a quick check if folder paths, uploads locations, or theme assets changed.
Drafted with AI; not yet reviewed by a person.