WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/10/2015 03:16:51 PM (5 years ago)
Author:
rachelbaker
Message:

Comments: Comments don’t need no Post ID when created, so they don’t be needing one to be edited.

In wp_update_comment() only check if the given comment_post_ID is valid if it isn’t 0. This allows comments that were created programmatically via wp_insert_comment() without the (optional) comment_post_ID parameter to be edited.

Props subharanjan for the initial patch.
Fixes #34954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r35745 r35853  
    19051905
    19061906    // Make sure that the comment post ID is valid (if specified).
    1907     if ( isset( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {
     1907    if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {
    19081908        return 0;
    19091909    }
Note: See TracChangeset for help on using the changeset viewer.