WP-CLI Global Configuration Command

Build Status GitHub Packagist Version

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.


WP-CLI logo

Table of Contents

Installation

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.

Structure

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].

Commands

List of WP-CLI global config Commands:

Show list

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

Set New Config

Structure:

wp global-config set <key> <value> [--local]

For example, set new path:

wp global-config set path ~/wp-cli/site
Set new config with the boolean value
wp global-config set color false
Set new config with the number value
wp global-config set my-custom-number 100
Set new config with the array value

use JSON Format.

wp global-config set disabled_commands '["db drop","plugin install"]'
Set new config with the null value
wp global-config set db_pass null
Set new config with space in key
wp global-config set "config create" new_value
Set new config with empty value
wp global-config set db_pass ''

Set new config with nested array key

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

Get Config Value

Structure:

wp global-config get <key> [--local]

For example:

wp global-config get port

or for local config:

wp global-config get url --local

Remove Config Value

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

Reset Configuration

wp global-config reset

For local current directory config:

wp global-config reset --local

Author

Contributing

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.

Reporting a bug

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.

Creating a pull request

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:

  1. Create a feature branch for each contribution.
  2. Submit your pull request early for feedback.
  3. Follow PSR-2 Coding Standards.