wp cli - Does WP-CLI support updating multiple options via a single command?

I'm looking for a way to update multiple options via a single update command. The documentation only suggests the f

I'm looking for a way to update multiple options via a single update command. The documentation only suggests the following usage:

wp option update <key> <new_value>

Does WP-CLI accept multiple key value pairs or a JSON or some other file containing multiple option keys and their new values?

I'm looking for a way to update multiple options via a single update command. The documentation only suggests the following usage:

wp option update <key> <new_value>

Does WP-CLI accept multiple key value pairs or a JSON or some other file containing multiple option keys and their new values?

Share Improve this question asked Apr 29, 2019 at 14:06 JohnJohn 1,4492 gold badges19 silver badges29 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

WP CLI's option update command only accepts one key per call, but you can use other commands to handle updating multiple keys in sequence. The command page in the Codex has some examples.

# Update one option on multiple sites using xargs.
$ wp site list --field=url | xargs -n1 -I {} sh -c 'wp --url={} option update my_option my_value'

In this example, xargs is used to build commands based on input.

Depending on your data structure, you should be able to use xargs and some wp cli commands in combination to achieve the result you're looking for.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745539998a4632083.html

相关推荐

  • wp cli - Does WP-CLI support updating multiple options via a single command?

    I'm looking for a way to update multiple options via a single update command. The documentation only suggests the f

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信