Fix wp_site.domain in db-pull multisite fixup - #234
Merged
Merged
Conversation
jasperf
added a commit
that referenced
this pull request
Sep 19, 2026
siteurl and home diverge on Bedrock (siteurl carries the /wp core subdirectory, home doesn't), but db-pull's search-replace was built from siteurl alone. Content — nav menus, post guids, the home option itself — is written against home, never siteurl, so the replace matched nothing there, exited 0, and the pulled site looked fine until someone clicked a menu link and landed back on production. Found on demo.imagewize.com after a --multisite pull: every subsite's block-based Navigation menu, and several post guids, still pointed at https://demo.imagewize.com/... even though wp_blogs.domain/ wp_site.domain (the #234 fix) were both already correct — this is a separate gap from that one. Both db-pull.sh and the db_pull MCP tool now read home for prod and dev alongside siteurl, and run a second search-replace pass against the home pair whenever it differs from the siteurl pair (always, on Bedrock; skipped on non-Bedrock installs where siteurl === home). A third pass replaces the http:// form of prod's home when prod is on https://. Content written before a site moved to HTTPS still links to http://example.com/..., which neither of the other passes matches — the manual fix on demo.imagewize.com needed both variants.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
db-pull --multisiterewrotewp_blogs.domainbut notwp_site.domain, so a pulled multisite network came back half-rewritten.Both columns store a bare hostname, which is why the multisite fixup exists in the first place — the ordinary
search-replacelooks for a scheme-prefixed URL (https://example.com→http://example.test) and never matches either column. The fixup covered the subsites and left the network row alone.The result: every subsite on the development host, and the network itself still claiming the production domain, disagreeing with
DOMAIN_CURRENT_SITEin the local config. The front end still renders, which is what makes it easy to miss — it surfaces later as network-admin URLs and redirects built from the production host.Found on
demo.imagewize.com(9 subsites) after a--multisitepull:Changes
scripts/backup/db-pull.sh— the multisite step now runs a secondUPDATEagainstwp_site, alongside the existingwp_blogsone. Step label updated to "Fixing multisite network and blog domains".mcp-server/src/tools/dbPull.ts— same fix for thedb_pullMCP tool; both statements go through onewp db querycall.mcp-server/src/server.ts—multisiteflag description updated.CHANGELOG.md— 5.24.1.wp_sitemeta.siteurlneeded no change — it holds a full scheme-prefixed URL, so the ordinarysearch-replacealready reaches it. Verified on the same network.Scope
Single-site pulls are untouched: without
--multisite, neither statement runs. The newUPDATEuses the samewp_table prefix the existing code already assumed.Verification
bash -n scripts/backup/db-pull.sh— clean.npx tsc --noEmitinmcp-server/— clean.demo.imagewize.comnetwork:wp db queryaccepts both in one call, and re-running it reportsRows affected: 0— the fixup is idempotent.