[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
Thu Jul 2 17:28:47 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:  has-patch          |     Focuses:
-------------------------------+------------------------------

Comment (by stuffradio):

 Here's a look here at the various cases I came up with. I have meta rows
 where the single key exists and is set to false, single key exists and is
 set to true and the single key doesn't exist. If the key doesn't exist, it
 defaults to the same as if it was set to true.


 {{{
         $double_meta_post = wp_insert_post(
                         array(
                                         'post_title' => 'Multiple meta
 rows',
                                         'post_name' => 'multiple-rows',
                                         'meta_single' => false,
                                         'meta_input' => array(
                                                         'key_1' => 1,
                                                         'key_2' => 'some
 string value',
                                                         'key_3' =>
 '15.51',
                                                         'visited_states'
 => array(
 'single' => true,
 'Massachusetts',
 'Rhode Island',
 'Washington',
                                                         ),
                                         )
                         )
         );
 }}}

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


More information about the wp-trac mailing list