Opened 13 years ago
Closed 13 years ago
#20572 closed defect (bug) (fixed)
wp-includes/comment-template:comment_form() calling comment_open() without passing $post_id
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
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) ) : ?>
The file in question with my patch applied