Wp option (WP-CLI): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 1: | Regel 1: | ||
− | ''wp option'': | + | ''wp option'': manage settings maintained in table <code>wp_options</code>. These are object-independent settings and 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' - something I have difficulty with at SQL level. |
− | ''wp option'' | + | ''wp option'' itself doesn't do much: The magic is in the subcommands. |
<pre> | <pre> | ||
Regel 53: | Regel 53: | ||
</pre> | </pre> | ||
− | == | + | == See also == |
− | * [[wp option add (WP-CLI) | | + | * [[wp option add (WP-CLI) | wp option add]] |
− | * [[wp option delete (WP-CLI) | | + | * [[wp option delete (WP-CLI) | wp option delete]] |
− | * [[wp option get (WP-CLI) | | + | * [[wp option get (WP-CLI) | wp option get]] |
− | * [[wp option list (WP-CLI) | | + | * [[wp option list (WP-CLI) | wp option list]] |
− | * [[wp option patch (WP-CLI) | | + | * [[wp option patch (WP-CLI) | wp option patch]] |
− | * [[wp option pluck (WP-CLI) | | + | * [[wp option pluck (WP-CLI) | wp option pluck]] |
− | * [[wp option update (WP-CLI) | | + | * [[wp option update (WP-CLI) | wp option update]] |
Versie van 16 nov 2023 14:25
wp option: manage settings maintained in table wp_options
. These are object-independent settings and 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' - something I have difficulty with at SQL level.
wp option itself doesn't do much: The magic is in the subcommands.
$ 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.