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 @@ -1887,6 +1887,32 @@ wp option patch <action> <key> <key-path>... [<value>] [--format=<format>]
18871887 - json
18881888 ---
18891889
1890+ ** EXAMPLES**
1891+
1892+ # Add 'bar' to the 'foo' key on an option with name 'option_name'
1893+ $ wp option patch insert option_name foo bar
1894+ Success: Updated 'option_name' option.
1895+
1896+ # Update the value of 'foo' key to 'new' on an option with name 'option_name'
1897+ $ wp option patch update option_name foo new
1898+ Success: Updated 'option_name' option.
1899+
1900+ # Set nested value of 'bar' key to value we have in the patch file on an option with name 'option_name'.
1901+ $ wp option patch update option_name foo bar < patch
1902+ Success: Updated 'option_name' option.
1903+
1904+ # Update the value for the key 'not-a-key' which is not exist on an option with name 'option_name'.
1905+ $ wp option patch update option_name foo not-a-key new-value
1906+ Error: No data exists for key "not-a-key"
1907+
1908+ # Update the value for the key 'foo' without passing value on an option with name 'option_name'.
1909+ $ wp option patch update option_name foo
1910+ Error: Please provide value to update.
1911+
1912+ # Delete the nested key 'bar' under 'foo' key on an option with name 'option_name'.
1913+ $ wp option patch delete option_name foo bar
1914+ Success: Updated 'option_name' option.
1915+
18901916
18911917
18921918### wp option pluck
You can’t perform that action at this time.
0 commit comments