[wp-trac] [WordPress Trac] #34848: Add support for updating post meta in bulk

WordPress Trac noreply at wordpress.org
Sun Dec 3 22:14:36 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
-------------------------------------------------+-------------------------
Changes (by bradparbs):

 * keywords:  has-patch has-unit-tests needs-testing => has-patch has-unit-
     tests needs-testing close


Comment:

 After a lot of discussion and brainstorming with @peterwilsoncc, I'm
 really thinking this might need a a bit of a different approach. Right
 now, the update doesn't support a lot of native utilities, such as passing
 an old value to update across, etc.

 I'm also thinking the delete and then insert pattern for updating isn't
 the safest thing. I'd hate to have a race condition or DB failure that
 causes data loss to a user. Potentially we could check what keys exist,
 run a normal `update_post_meta` on those, and then a bulk insert on the
 the rest.

 Overall, I think bulk update should be the focus, because that's most
 likely going to be the most used function of all of these, just like the
 usages of `update_post_meta` vs `add_post_meta` in plugins/projects.

 Updates are really a can of worms with a lot of edge cases. I think we
 need a cleaner solution to them before this is ready.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34848#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list