WP-CLI has a series of global parameters (e.g. --path= and --user=) which work with all commands.
This config saved in config.yml
or wp-cli.yml
files. [WP-CLI Document].
With this package, you can easily add, delete or edit WP-CLI global parameters in the command line and you no longer need to edit the source settings file.
You can install this package with:
wp package install wp-packagist/wp-cli-global-config-command
Installing this package requires WP-CLI v2 or greater. Update to the latest stable release with
wp cli update
.
NAME
wp global-config
DESCRIPTION
Global Configuration.
SYNOPSIS
wp global-config <command>
SUBCOMMANDS
get Show Custom Config.
list Show Configuration list.
remove Remove Config Parameter.
reset Reset Configuration.
set Set new config.
For All commands in this package, you can use --local
flag for process in a local config file current working directory [wp-cli.local.yml].
List of WP-CLI global config Commands:
For show list all global parameters:
wp global-config list
also for show list of all global config in the current directory:
wp global-config list --local
Structure:
wp global-config set <key> <value> [--local]
For example, set new path:
wp global-config set path ~/wp-cli/site
wp global-config set color false
wp global-config set my-custom-number 100
use JSON Format.
wp global-config set disabled_commands '["db drop","plugin install"]'
wp global-config set db_pass null
wp global-config set "config create" new_value
wp global-config set db_pass ''
you can use :
caharacter per level.
wp global-config set @staging:user <value>
example 2:
wp global-config set @staging:user:ID 32
example 3:
disable plugin install command only in the current directory project.
wp global-config set disabled_commands '["plugin install"]' --local
Structure:
wp global-config get <key> [--local]
For example:
wp global-config get port
or for local config:
wp global-config get url --local
Structure:
wp global-config remove <key>
for example:
wp global-config remove path
wp global-config remove color --local
You can also nested key name in this command.
wp global-config remove key_1:key_2_child
wp global-config reset
For local current directory config:
wp global-config reset --local
- Mehrshad Darzi | PHP Full Stack and WordPress Expert
We appreciate you taking the initiative to contribute to this project.
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
Think you’ve found a bug? We’d love for you to help us get it fixed. Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project.
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
- Create a feature branch for each contribution.
- Submit your pull request early for feedback.
- Follow PSR-2 Coding Standards.