[wp-trac] [WordPress Trac] #20572: wp-includes/comment-template:comment_form() calling comment_open() without passing $post_id

WordPress Trac wp-trac at lists.automattic.com
Mon Apr 30 01:39:32 UTC 2012


#20572: wp-includes/comment-template:comment_form() calling comment_open() without
passing $post_id
------------------------------+---------------------------------------
 Reporter:  insertvisionhere  |      Owner:  jaap@…
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Comments          |    Version:
 Severity:  normal            |   Keywords:  has-patch
------------------------------+---------------------------------------
 Although you can pass a post_id to wp-includes/comment-
 template:comment_form()in order to specify which post to add a comment
 form to, on line 1553 this function calls if( comments_open() ) but
 doesn't pass it through the post_id argument.

 I encountered this bug by using ajax to call a page with a custom post
 type from a standard page. The page called via ajax calls
 comments_template() which in turn calls comment_form() and passes it the
 post_id of the ajax page, however that post_id doesn't make it to
 comments_open() meaning it searches for comment status on the standard
 page and not the page called through ajax.

 This can be fixed by changing <?php if ( comments_open() ) : ?> on line
 1553 to <?php if ( comments_open($post_id) ) : ?>

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20572>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list