wp option <command>

Retrieves and sets site options, including plugin and WordPress settings.

In this article

See the Plugin Settings API and the Theme Options for more information on adding customized options.

Common Options

These are some of the most commonly used WordPress options:
  • siteurl – Site URL, e.g. http://example.com
  • blogname – Site title
  • blogdescription – Site tagline
  • admin_email – Administration email address
  • default_role – Default role for new users
  • timezone_string – Local timezone, e.g. “America/New_York”
  • home – Home URL, e.g. http://example.com
  • blog_public – Discourage search engines when set to 0
For the full list of available options, see the Option Reference.

Examples

# Get site URL.
$ wp option get siteurl
http://example.com

# Add option.
$ wp option add my_option foobar
Success: Added 'my_option' option.

# Update option.
$ wp option update my_option '{"foo": "bar"}' --format=json
Success: Updated 'my_option' option.

# Delete option.
$ wp option delete my_option
Success: Deleted 'my_option' option.

Subcommands

NameDescription
wp option add

Adds a new option value.

wp option delete

Deletes an option.

wp option get

Gets the value for an option.

wp option get-autoload

Gets the ‘autoload’ value for an option.

wp option list

Lists options and their values.

wp option patch

Updates a nested value in an option.

wp option pluck

Gets a nested value from an option.

wp option set

Updates an option value.

wp option set-autoload

Sets the ‘autoload’ value for an option.

wp option update

Updates an option value.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.