Repository navigation
Explain that only one project config file is read - #682
Merged
Merged
Conversation
The Config files section lists wp-cli.local.yml and wp-cli.yml as if both are read. WP-CLI uses only the first of them it finds, so in a folder with both, wp-cli.yml is ignored unless wp-cli.local.yml inherits it.
Contributor
schlessera
approved these changes
Nov 27, 2026
schlessera
left a comment
Member
There was a problem hiding this comment.
Thanks for clarifying this behavior and adding the _: inherit: wp-cli.yml example, @ekamran! LGTM.
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
The "Config files" section lists
wp-cli.local.ymlandwp-cli.ymlone after the other, which reads as if WP-CLI loads both. It loads only one:Runner::get_project_config_path()looks forwp-cli.local.yml, thenwp-cli.yml, in the current folder and then each parent folder, and stops at the first file it finds. In a folder with both,wp-cli.ymlis ignored.This came up in wp-cli/wp-cli#5784, where the answer was to inherit
wp-cli.ymlfromwp-cli.local.yml. This PR adds that to the page.Changes
_: inherit: wp-cli.yml.Verification
Checked with WP-CLI 2.12.0 and current
main, using an alias in each config file to see which files were read (wp cli alias list) andwp cli infofor the project config path:wp-cli.local.ymlandwp-cli.ymlin the same folder: only the aliases fromwp-cli.local.ymland~/.wp-cli/config.ymlare listed._: inherit: wp-cli.ymlinwp-cli.local.yml: aliases from all three files are listed, and an alias defined in both project files keeps the value fromwp-cli.local.yml.wp-cli.ymlin the current folder andwp-cli.local.ymlin its parent: only the nearerwp-cli.ymlis read.wp-cli.local.ymlnext towp-cli.ymlis enough to stopwp-cli.ymlfrom being read.git diff --check.Use of AI
AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: checking the config loading code, testing it against WP-CLI 2.12.0 and
main, drafting the change, and reviewing it. I reviewed the reasoning and test results, and I take responsibility for the contribution.Summary by CodeRabbit