[wp-trac] [WordPress Trac] #41949: Allow multiple values for the same meta key to be passed to `wp_insert_post()`

WordPress Trac noreply at wordpress.org
Fri Jun 26 14:17:46 UTC 2020


#41949: Allow multiple values for the same meta key to be passed to
`wp_insert_post()`
-------------------------------+------------------------------
 Reporter:  desrosj            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.4
 Severity:  normal             |  Resolution:
 Keywords:  needs-patch        |     Focuses:
-------------------------------+------------------------------

Comment (by desrosj):

 @stuffradio Whew, this was a while ago. I believe that is what I was
 looking for, though.

 {{{
 'meta_input' => array(
     'key_1' => 1,
     'key_2' => 'some string value',
     'key_3' => '15.51,
     'visited_states' => array(
         'Massachusetts',
         'Rhode Island',
         'Washington',
         etc...
     ),
 );
 }}}

 Currently, the only way you would be able to add meta keys with multiple
 values would be to use a `foreach` after the new post ID is returned.
 Ideally all meta data could just be passed in the `meta_input` key.

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


More information about the wp-trac mailing list