Fix changing the WordPress version on a site that has never been started - #4314
Draft
bcotrim wants to merge 3 commits into
Draft
Fix changing the WordPress version on a site that has never been started#4314bcotrim wants to merge 3 commits into
bcotrim wants to merge 3 commits into
Conversation
Collaborator
📊 Performance Test ResultsComparing 52bbb9c vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
bcotrim
marked this pull request as draft
July 23, 2026 16:30
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.
Related issues
How AI was used in this PR
Claude Code implemented the fix and wrote the tests. I reviewed the diff myself.
Proposed Changes
Changing the WordPress version now works on a site that has never been started.
A site created with
--no-starthas WordPress files on disk but nowp-config.phpand no database — WordPress has not been installed yet. Any attempt to change its version failed withFailed to update WordPress version to <x>, because that path asks WP-CLI to boot a site that cannot boot. This affected the desktop app as well as the CLI: Site Settings sends the same command.Nothing but the core files on disk decides such a site's version, so Studio now swaps those files in — exactly what
site create --wp <version>does — and lets the WordPress installer run against them on the first start. Sites that have been started keep usingwp core updateas before.Doing it this way also avoids a downgrade hazard: provisioning a database up front would install WordPress at the current version, and moving to an older version afterwards would leave the database at a newer schema than the code, which WordPress has no path back from.
WP-CLI failures now say what actually went wrong.
Several places threw a generic message and discarded WP-CLI's output entirely, which is why the original report showed
stdout: '', stderr: ''and no reason at all. A failing export said onlyDatabase export failed. Errors now carry WP-CLI's own message, from both streams — which stream carries it depends on the runtime, and a message on the unread stream is a message nobody sees.Trade-offs / known limits
site createalready does on an existing WordPress directory; the site installs and serves normally (verified below).Testing Instructions
Build the CLI first:
npm run cli:buildFailed to update WordPress version to 6.6.5, exit code 1.✔ WordPress version updated.Confirm the files actually changed, then that the site installs at that version
Pre-merge Checklist