X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..2329f698283944696a7076258cf816545970bb47:/wp-comments-post.php diff --git a/wp-comments-post.php b/wp-comments-post.php index 6196c368..0ed359c5 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -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( __( "ERROR: The comment could not be saved. Please try again later." ) ); +} + +$comment = get_comment( $comment_id ); /** * Perform other actions when comment cookies are set.