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

WordPress Trac noreply at wordpress.org
Thu Apr 14 16:57:21 UTC 2016


#34848: Add support for updating post meta in bulk
------------------------------------------+-----------------------------
 Reporter:  patrickgarman                 |       Owner:  chriscct7
     Type:  enhancement                   |      Status:  assigned
 Priority:  normal                        |   Milestone:  Future Release
Component:  Options, Meta APIs            |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:  performance
------------------------------------------+-----------------------------

Comment (by boonebgorges):

 A thought: What if `add_metadata()` and `update_metadata()` handled this
 natively? We could avoid a lot of duplicated code (and bad function names)
 by using the functions we already have. Syntax:

 {{{
 function add_metadata( $meta_type, $object_id, $meta_key, $meta_value,
 $unique = false ) {
     if ( is_array( $meta_key ) ) {
         $metadata = $meta_key;
     } else {
         $metadata = array( $meta_key => $meta_value );
     }

     // etc
 }
 }}}

 Obviously this is way oversimplified - I don't love having an ambiguous
 function signature - but I think the developer experience would be much
 better.

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


More information about the wp-trac mailing list