[wp-trac] [WordPress Trac] #56243: Use a consistent parameter name for functions accepting a post ID or post object

WordPress Trac noreply at wordpress.org
Mon Jul 18 23:41:19 UTC 2022


#56243: Use a consistent parameter name for functions accepting a post ID or post
object
-------------------------------+-------------------------------------
 Reporter:  SergeyBiryukov     |       Owner:  SergeyBiryukov
     Type:  enhancement        |      Status:  accepted
 Priority:  normal             |   Milestone:  6.1
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:  docs, coding-standards
-------------------------------+-------------------------------------

Comment (by peterwilsoncc):

 The change to `comment_form()` appears to change the behaviour.

 Previously if an invalid post ID was passed to the function
 `comments_open()` would return false and no comment form be displayed.

 The new conditional `$post_id = $post ? $post->ID : get_the_ID();` means
 that if an invalid post ID is passed to the `comment_form()`, the form
 will be display for the current global post.

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


More information about the wp-trac mailing list