Title: wp-cli wp option patch create array
Last modified: January 27, 2019

---

# wp-cli wp option patch create array

 *  Resolved [durrmann](https://wordpress.org/support/users/durrmann/)
 * (@durrmann)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/wp-cli-wp-option-patch-create-array/)
 * Hello,
 * i am wondering how to create an array of values in a option using wp-cli.
    I 
   can insert information into that array usign: wp option patch insert woocommerce_bacs_accounts
   0 account_name “BankAccount” I can read options from the array using: wp option
   pluck woocommerce_bacs_accounts 0 account_name
 * How do i create an array initially in a wp option?
    Thank you for your help!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwp-cli-wp-option-patch-create-array%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [durrmann](https://wordpress.org/support/users/durrmann/)
 * (@durrmann)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-wp-option-patch-create-array/#post-11310179)
 * Is this impossible?
 *  Thread Starter [durrmann](https://wordpress.org/support/users/durrmann/)
 * (@durrmann)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-wp-option-patch-create-array/#post-11314856)
 * It is not. The following command does the trick:
 * wp option add the_option2 ‘[{“foo”: “bar”}]’ –format=json
 * I did not find a way to do this without using JSON. The use of the standard wp
   option interface with add/insert/patch did not do the trick without JSON. Also
   the woocommerce cli did not support this so far.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp-cli wp option patch create array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [pluck](https://wordpress.org/support/topic-tag/pluck/)
 * [settings](https://wordpress.org/support/topic-tag/settings/)
 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 1 participant
 * Last reply from: [durrmann](https://wordpress.org/support/users/durrmann/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/wp-cli-wp-option-patch-create-array/#post-11314856)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
