]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-comments-post.php
WordPress 4.0
[autoinstalls/wordpress.git] / wp-comments-post.php
index 6196c368423a5bf6dd1b249a681c46bee609f14b..0ed359c5bb763161ee98783ae0dd96b52c548c71 100644 (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 );
 $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.
 
 /**
  * Perform other actions when comment cookies are set.