Wp option (WP-CLI)
Naar navigatie springen
Naar zoeken springen
wp option: manage settings maintained in table wp_options
. These are object-independent settings. Hence you cannot request the 'options' that belong to a specific page, post or product. This command is an important tool for managing a site entirely through the shell. Especially since this command can handle serialized data.
$ wp help option NAME wp option DESCRIPTION Retrieves and sets site options, including plugin and WordPress settings. SYNOPSIS wp option <command> SUBCOMMANDS add Adds a new option value. delete Deletes an option. get Gets the value for an option. list Lists options and their values. patch Updates a nested value in an option. pluck Gets a nested value from an option. update Updates an option value. See the [Plugin Settings API][1] and the [Theme Options][2] for more information on adding customized options. --- [1] https://developer.wordpress.org/plugins/settings/settings-api/ [2] https://developer.wordpress.org/themes/customize-api/ 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.
See also
- wp option add
- wp option delete
- wp option get
- wp option list
- wp option patch
- wp option pluck
- wp option update
- wp post meta - The equivalent for meta fields - Like options, but associated with posts.