[wp-trac] [WordPress Trac] #34848: Add support for updating post meta in bulk
WordPress Trac
noreply at wordpress.org
Mon Dec 4 22:35:07 UTC 2017
#34848: Add support for updating post meta in bulk
-------------------------------------------------+-------------------------
Reporter: patrickgarman | Owner: chriscct7
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future
Component: Options, Meta APIs | Release
Severity: normal | Version:
Keywords: has-patch has-unit-tests needs- | Resolution:
testing close | Focuses:
| performance
-------------------------------------------------+-------------------------
Comment (by peterwilsoncc):
I really like the idea but it's `update_?` that I have the biggest
concerns about:
* there is no support for updating based on the existing meta value, this
is required for the bypass filter to work and for feature parity
* delete and add in the current form will delete duplicates
* updates with the existing value specified will require one of two
approaches:
- multiple database calls to so you can use different `WHERE` clauses
- getting all of an objects meta data and filtering the array
* new meta data (ie, a new `meta_key`) will need to call the add function,
remember to consider the existing value
* updates will need to use sql `UPDATE`s, meta_id and order in which the
data is inserted will need to stay the same. These will almost certainly
need to be unique DB calls to allow for unique `WHERE` clauses
I like @boonebgorges's suggestion above of making the existing functions
support an array. The existing signature can be supported via a self-
invoking function call.
The way ahead:
I would like to see a plugin that with a proof of concept. The `meta_key`
attribute can be an array & get to the bypass filter.
On the bypass filter, the plugin intercepts the code and runs the bulk
update. A meta key, object ID and object type is enough to get through the
validation.
Rubber ducking this with @bradparbs yesterday, there were a lot of edge
cases that need to be considered.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34848#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list