admin管理员组文章数量:1429628
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 badges1 Answer
Reset to default 1WP 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.
本文标签: wp cliDoes WPCLI support updating multiple options via a single command
版权声明:本文标题:wp cli - Does WP-CLI support updating multiple options via a single command? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745539998a2662449.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论