en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en de en de en de en de de en en en fr fr fr fr ca en fr fr ca ca en fr en en en es fr fr fr fr fr fr fr fr sv en en en en en en km en en en en en en en kn en en en en en en kn en en en en en hbs_lat en kn en en en en en en kn en en en en en en kn en en en en en hbs_lat kn en en en en en en en en en en hbs_lat kn en en en en en en kn en en en en en en en en en en en en en en en en en en en en en en en en en id en en en
[--config-file= ] Specify the file path to the config file to be edited. Defaults to the root of the WordPress installation and the filename "wp-config.php".
# Launch system editor to edit wp-config.php file $ wp config edit # Edit wp-config.php file in a specific editor $ EDITOR=vim wp config edit
Deletes a specific constant or variable from the wp-config.php file.
wp config delete   [--type= ] [--config-file= ]
# Delete the COOKIE_DOMAIN constant from the wp-config.php file. $ wp config delete COOKIE_DOMAIN
wp config create --dbname=  --dbuser=  [--dbpass= ] [--dbhost= ] [--dbprefix= ] [--dbcharset= ] [--dbcollate= ] [--locale= ] [--extra-php] [--skip-salts] [--skip-check] [--force] [--config-file= ] [--insecure]
Creates a new wp-config.php with database constants, and verifies that the database constants are correct.
--dbname=  Set the database name. --dbuser=  Set the database user. [--dbpass= ] Set the database user password. [--dbhost= ] Set the database host. --- default: localhost --- [--dbprefix= ] Set the database table prefix. --- default: wp_ --- [--dbcharset= ] Set the database charset. --- default: utf8 --- [--dbcollate= ] Set the database collation. --- default: --- [--locale= ] Set the WPLANG constant. Defaults to $wp_local_package variable. [--extra-php] If set, the command copies additional PHP code into wp-config.php from STDIN. [--skip-salts] If set, keys and salts won't be generated, but should instead be passed via `--extra-php`. [--skip-check] If set, the database connection is not checked. [--force] Overwrites existing files, if present. [--config-file= ] Specify the file path to the config file to be created. Defaults to the root of the WordPress installation and the filename "wp-config.php". [--insecure] Retry API download without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
# Standard wp-config.php file $ wp config create --dbname=testing --dbuser=wp --dbpass=securepswd --locale=ro_RO Success: Generated 'wp-config.php' file. # Enable WP_DEBUG and WP_DEBUG_LOG $ wp config create --dbname=testing --dbuser=wp --dbpass=securepswd --extra-php <<PHP define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); PHP Success: Generated 'wp-config.php' file. # Avoid disclosing password to bash history by reading from password.txt # Using --prompt=dbpass will prompt for the 'dbpass' argument $ wp config create --dbname=testing --dbuser=wp --prompt=dbpass < password.txt Success: Generated 'wp-config.php' file.
Gets the value of a specific constant or variable defined in wp-config.php file.
wp config get   [--type= ] [--format= ] [--config-file= ]
Name of the wp-config.php constant or variable. [--type= ] Type of config value to retrieve. Defaults to 'all'. --- default: all options: - constant - variable - all --- [--format= ] Get value in a particular format. Dotenv is limited to non-object values. --- default: var_export options: - var_export - json - yaml - dotenv --- [--config-file= ] Specify the file path to the config file to be read. Defaults to the root of the WordPress installation and the filename "wp-config.php".
# Get the table_prefix as defined in wp-config.php file. $ wp config get table_prefix wp_
Checks whether a specific constant or variable exists in the wp-config.php file.
wp config has   [--type= ] [--config-file= ]
Name of the wp-config.php constant or variable. [--type= ] Type of the config value to set. Defaults to 'all'. --- default: all options: - constant - variable - all --- [--config-file= ] Specify the file path to the config file to be checked. Defaults to the root of the WordPress installation and the filename "wp-config.php".
# Check whether the DB_PASSWORD constant exists in the wp-config.php file. $ wp config has DB_PASSWORD
Lists variables, constants, and file includes defined in wp-config.php file.
wp config list [ ...] [--fields= ] [--format= ] [--strict] [--config-file= ]
[ ...] Name or partial name to filter the list by. [--fields= ] Limit the output to specific fields. Defaults to all fields. [--format= ] Render output in a particular format. Dotenv is limited to non-object values. --- default: table options: - table - csv - json - yaml - dotenv --- [--strict] Enforce strict matching when a filter is provided. [--config-file= ] Specify the file path to the config file to be read. Defaults to the root of the WordPress installation and the filename "wp-config.php".
Gets the path to wp-config.php file.
# Get wp-config.php file path $ wp config path /home/person/htdocs/project/wp-config.php
Sets the value of a specific constant or variable defined in wp-config.php file.
wp config set     [--add] [--raw] [--anchor= ] [--placement= ] [--separator= ] [--type= ] [--config-file= ]
Name of the wp-config.php constant or variable.   Value to set the wp-config.php constant or variable to. [--add] Add the value if it doesn't exist yet. This is the default behavior, override with --no-add. [--raw] Place the value into the wp-config.php file as is, instead of as a quoted string. [--anchor= ] Anchor string where additions of new values are anchored around. Defaults to "/* That's all, stop editing!". The special case "EOF" string uses the end of the file as the anchor. [--placement= ] Where to place the new values in relation to the anchor string. --- default: 'before' options: - before - after --- [--separator= ] Separator string to put between an added value and its anchor string. The following escape sequences will be recognized and properly interpreted: '\n' => newline, '\r' => carriage return, '\t' => tab. Defaults to a single EOL ("\n" on *nix and "\r\n" on Windows). [--type= ] Type of the config value to set. Defaults to 'all'. --- default: all options: - constant - variable - all --- [--config-file= ] Specify the file path to the config file to be modified. Defaults to the root of the WordPress installation and the filename "wp-config.php".
# Set the WP_DEBUG constant to true. $ wp config set WP_DEBUG true --raw
Refreshes the salts defined in the wp-config.php file.
wp config shuffle-salts [ ...] [--force] [--config-file= ] [--insecure]
[ ...] One ore more keys to shuffle. If none are provided, this falls back to the default WordPress Core salt keys. [--force] If an unknown key is requested to be shuffled, add it instead of throwing a warning. [--config-file= ] Specify the file path to the config file to be modified. Defaults to the root of the WordPress installation and the filename "wp-config.php". [--insecure] Retry API download without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
# Get new salts for your wp-config.php file $ wp config shuffle-salts Success: Shuffled the salt keys. # Add a cache key salt to the wp-config.php file $ wp config shuffle-salts WP_CACHE_KEY_SALT --force
This package is included with WP-CLI itself, no additional installation necessary.
To install the latest version of this package over what's included in WP-CLI, run:
wp package install git@github.com:wp-cli/config-command.git
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.
For a more thorough introduction, check out WP-CLI's guide to contributing. This package follows those policy and guidelines.
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.
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please create a new issue. Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, review our bug report documentation.
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. See "Setting up" for details specific to working on this package locally.
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
This README.md is generated dynamically from the project's codebase using wp scaffold package-readme (doc). To suggest changes, please submit a pull request against the corresponding part of the codebase.