-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Adding/Updating Multiple Options at Once #230
Comments
It's certainly possible to add something like this. I just don't see any benefit in this. Even with JSON input it would be way less readable than just looping through an array in bash and pass the values to Can you perhaps elaborate on your use case? |
There would actually be a benefit to this: you only load up WordPress once for updating multiple options in one go. |
@schlessera Thanks for weighing in on this…your comment sums up my thinking perfectly. @swissspidy The company I work for builds and manages WordPress multisite networks for some fairly large organizations. We use WP-CLI for setting up and maintaining these networks, and currently we are doing what you described – wrapping multiple calls to We've noticed that it takes a long time to run these scripts, especially when we are spinning up a new multisite network preloaded with 15-20 sites and populating 30-40 options per site, or performing maintenance on a network of 400+ sites, for example. If it could be possible to update multiple options in one shot, this would save us a great deal of time, and I can also see this being a benefit for the community at large. |
Identifying key and value for multiple options will be harder when so many options to update at a time but we can use JSON file to update multiple options. This way we can update every option defined in json file by loading WordPress instance for one time only. What do you think about this approach @schlessera? |
@daleharrison @sagarnasit Just wanted to know how have you guys been handling this case? (if any other than looping the keys and values individually) |
+1 vote for this. My use case is the same as @daleharrison's. When setting many options for many sites in a multisite network, the time to execute each WP-CLI command separately adds up. |
+1 |
2 similar comments
+1 |
+1 |
+1 In the meantime, here is something that is working for me. When you are updating tens or hundreds of options, the difference is ridiculous, seconds vs minutes, probably exponentially so. (Disclaimer: this solution could certainly have security issues, those considerations are out of my purview)
|
I was just looking at wp-cli/wp-cli#2972 and #220 (regarding deleting multiple options), but I haven't seen anyone requesting what I'm looking for.
I'm wondering if it'd be possible to do something like this:
$ wp option update blogname "Random blog name" blogdescription "Some random blog description"
I'm not sure if this is the way it would actually be implemented – perhaps the options would need to be specified in JSON format instead, or something similar.
Perhaps this is already possible in some other way…if so, I hope someone can point me in the right direction as I can't find any documentation on this.
The text was updated successfully, but these errors were encountered: