File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,32 @@ function( $key ) {
548548 * - plaintext
549549 * - json
550550 * ---
551+ *
552+ * ## EXAMPLES
553+ *
554+ * # Add 'bar' to the 'foo' key on an option with name 'option_name'
555+ * $ wp option patch insert option_name foo bar
556+ * Success: Updated 'option_name' option.
557+ *
558+ * # Update the value of 'foo' key to 'new' on an option with name 'option_name'
559+ * $ wp option patch update option_name foo new
560+ * Success: Updated 'option_name' option.
561+ *
562+ * # Set nested value of 'bar' key to value we have in the patch file on an option with name 'option_name'.
563+ * $ wp option patch update option_name foo bar < patch
564+ * Success: Updated 'option_name' option.
565+ *
566+ * # Update the value for the key 'not-a-key' which is not exist on an option with name 'option_name'.
567+ * $ wp option patch update option_name foo not-a-key new-value
568+ * Error: No data exists for key "not-a-key"
569+ *
570+ * # Update the value for the key 'foo' without passing value on an option with name 'option_name'.
571+ * $ wp option patch update option_name foo
572+ * Error: Please provide value to update.
573+ *
574+ * # Delete the nested key 'bar' under 'foo' key on an option with name 'option_name'.
575+ * $ wp option patch delete option_name foo bar
576+ * Success: Updated 'option_name' option.
551577 */
552578 public function patch ( $ args , $ assoc_args ) {
553579 list ( $ action , $ key ) = $ args ;
You can’t perform that action at this time.
0 commit comments