Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/Option_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,32 @@ function( $key ) {
* - plaintext
* - json
* ---
*
* ## EXAMPLES
*
* # Add 'bar' to the 'foo' key on an option with name 'option_name'
* $ wp option patch insert option_name foo bar
* Success: Updated 'option_name' option.
*
* # Update the value of 'foo' key to 'new' on an option with name 'option_name'
* $ wp option patch update option_name foo new
* Success: Updated 'option_name' option.
*
* # Set nested value of 'bar' key to value we have in the patch file on an option with name 'option_name'.
* $ wp option patch update option_name foo bar < patch
* Success: Updated 'option_name' option.
*
* # Update the value for the key 'not-a-key' which is not exist on an option with name 'option_name'.
* $ wp option patch update option_name foo not-a-key new-value
* Error: No data exists for key "not-a-key"
*
* # Update the value for the key 'foo' without passing value on an option with name 'option_name'.
* $ wp option patch update option_name foo
* Error: Please provide value to update.
*
* # Delete the nested key 'bar' under 'foo' key on an option with name 'option_name'.
* $ wp option patch delete option_name foo bar
* Success: Updated 'option_name' option.
*/
public function patch( $args, $assoc_args ) {
list( $action, $key ) = $args;
Expand Down