Wp option (WP-CLI): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 1: Regel 1:
''wp option'': beheer instellingen die in tabel <code>wp_options</code> worden bijgehouden. Dit zijn object-onafhankelijke instellingen en je kunt dus niet de ''options'' opvragen die bij een specifieke pagina, post of product horen. Dit commando is een belangrijk stuk gereedschap om een site volledig via de shell te beheren. Temeer daar dit commando overweg kan met ''serialised data'' - Iets waar ik op SQL-niveau moeite mee heb.
+
''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'' zelf doet weinig: De magie zit 'm in de subcommando's.
+
''wp option'' itself doesn't do much: The magic is in the subcommands.
  
 
<pre>
 
<pre>
Regel 53: Regel 53:
 
</pre>
 
</pre>
  
== Zie ook ==
+
== See also ==
  
* [[wp option add (WP-CLI) |                       wp option add]]
+
* [[wp option add (WP-CLI) |     wp option add]]
* [[wp option delete (WP-CLI) |                     wp option delete]]
+
* [[wp option delete (WP-CLI) |   wp option delete]]
* [[wp option get (WP-CLI) |                       wp option get]]
+
* [[wp option get (WP-CLI) |     wp option get]]
* [[wp option list (WP-CLI) |                       wp option list]]
+
* [[wp option list (WP-CLI) |     wp option list]]
* [[wp option patch (WP-CLI) |                     wp option patch]]
+
* [[wp option patch (WP-CLI) |   wp option patch]]
* [[wp option pluck (WP-CLI) |                     wp option pluck]]
+
* [[wp option pluck (WP-CLI) |   wp option pluck]]
* [[wp option update (WP-CLI) |                     wp option update]]
+
* [[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.

See also