Support » Developing with WordPress » wp-cli wp option patch create array

  • Resolved durrmann



    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 to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is this impossible?

    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)
  • You must be logged in to reply to this topic.