wp_insert_comment() and wp_new_comment() should check if the comment was successfully inserted into the database.

props pento.
fixes #28254.

git-svn-id: https://develop.svn.wordpress.org/trunk@28672 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2014-06-05 04:37:02 +00:00
parent 4fde71e75d
commit c556e74943
2 changed files with 13 additions and 4 deletions
+5 -1
View File
@@ -132,7 +132,11 @@ $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_paren
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment( $commentdata );
$comment = get_comment($comment_id);
if ( ! $comment_id ) {
wp_die( __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) );
}
$comment = get_comment( $comment_id );
/**
* Perform other actions when comment cookies are set.