Fix child-theme scaffold error when --path contains relative segments#384
Merged
swissspidy merged 4 commits intomainfrom Apr 21, 2026
Merged
Conversation
… (..) Agent-Logs-Url: https://github.com/wp-cli/scaffold-command/sessions/07147131-58ed-4421-a27b-7fd97a13f800 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix child theme error when using --path argument
Fix child-theme scaffold error when --path contains relative segments
Apr 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes wp scaffold child-theme failing when --path includes relative segments like .. by canonicalizing both sides of the directory comparisons used to validate the target directory, and adds a Behat scenario intended to cover this regression.
Changes:
- Canonicalize
WP_CONTENT_DIR . '/themes'before comparing to the canonicalized target directory parent. - Canonicalize
WP_PLUGIN_DIRbefore comparing to the canonicalized target directory parent. - Add a Behat scenario intended to ensure scaffolding works when invoked from outside the install directory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Scaffold_Command.php |
Canonicalizes expected theme/plugin directories before comparing against the canonicalized target directory. |
features/scaffold.feature |
Adds a Behat scenario intended to cover relative-path (..) behavior for wp scaffold child-theme. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wp-cli/scaffold-command/sessions/a8984726-09d4-4601-bb50-2e88ba9310de Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
swissspidy
approved these changes
Apr 21, 2026
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.
check_target_directoryto canonicalize both sides of theme/plugin directory comparisons--path=..to exercise the regression