[wp-trac] [WordPress Trac] #43579: Optional post_id param in media_sideload_image and media_handle_sideload function

WordPress Trac noreply at wordpress.org
Fri May 24 22:24:46 UTC 2019


#43579: Optional post_id param in media_sideload_image and media_handle_sideload
function
-------------------------------------+-----------------------
 Reporter:  sebastian.pisula         |       Owner:  antpb
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  5.3
Component:  Media                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------

Comment (by SergeyBiryukov):

 Coming from
 [https://wordpress.slack.com/archives/C02RQBWTW/p1558720310071400 #core]
 to give a second committer opinion as requested :)

 Since `$post_id` is eventually [source:tags/5.2.1/src/wp-
 admin/includes/media.php?marks=459#L454 passed as `post_parent` to
 wp_insert_attachment()], I think the default value of `$post_id = 0` would
 be more appropriate. It would match the documented type (`int`) and would
 also be more consistent with the rest of core (~33 instances of `$post_id
 = 0` vs. ~9 of `$post_id = null`). In `get_post()`, both values are
 treated the same way.

 Looks good otherwise.

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


More information about the wp-trac mailing list