[wp-trac] [WordPress Trac] #34954: Comments Created Without a `comment_post_ID` Are Not Editable

WordPress Trac noreply at wordpress.org
Wed Dec 9 23:34:37 UTC 2015


#34954: Comments Created Without a `comment_post_ID` Are Not Editable
----------------------------+-----------------------------
 Reporter:  rachelbaker     |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Comments        |    Version:
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:  administration  |
----------------------------+-----------------------------
 If a comment is created via `wp_insert_comment()` without the optional
 `comment_post_ID` parameter, the value in the database is `0`.  The
 comment will display in the Comments list table, but if you try to edit
 the comment your changes never save.

 This is (at least in part) due to the following code from `src/wp-
 includes/comment.php`:
 {{{
 // Make sure that the comment post ID is valid (if specified).
         if ( isset( $commentarr['comment_post_ID'] ) && ! get_post(
 $commentarr['comment_post_ID'] ) ) {
                 return 0;
 }
 }}}

 The check here should be changed to `! empty()` since `isset()` would be
 true for a `0` value.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34954>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list