admin管理员组文章数量:1415684
I use this command to get values of ez-toc-settings->auto_insert_post_types
wp eval "print_r(get_option('ez-toc-settings')['auto_insert_post_types']);"
and this prints out the correct values:
Array
(
[post] => post
[page] => page
)
Now, I try to modify that so I have only "post" value I tried with:
wp eval "update_option('ez-toc-settings auto_insert_post_types', array('post'));"
Infact I have no idea on how to update a key value within a nested option.
I use this command to get values of ez-toc-settings->auto_insert_post_types
wp eval "print_r(get_option('ez-toc-settings')['auto_insert_post_types']);"
and this prints out the correct values:
Array
(
[post] => post
[page] => page
)
Now, I try to modify that so I have only "post" value I tried with:
wp eval "update_option('ez-toc-settings auto_insert_post_types', array('post'));"
Infact I have no idea on how to update a key value within a nested option.
Share Improve this question edited Aug 14, 2019 at 22:34 norman.lol 3,2313 gold badges30 silver badges35 bronze badges asked Aug 14, 2019 at 13:13 yarekyarek 1274 bronze badges1 Answer
Reset to default 1wp option
does all you need. See wp option patch
in particular.
Updates a nested value in an option.
Get a nested option value:
$ wp option pluck ez-toc-settings auto_insert_post_types
Set a nested option value (with an array):
$ wp option patch update ez-toc-settings auto_insert_post_types '{"post":"post"}' --format=json
本文标签: wp cliHow do I update a nested option
版权声明:本文标题:wp cli - How do I update a nested option? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745240881a2649322.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论