WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/05/2014 04:37:02 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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

props pento.
fixes #28254.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-comments-post.php

    r27192 r28672  
    133133
    134134$comment_id = wp_new_comment( $commentdata );
    135 $comment = get_comment($comment_id);
     135if ( ! $comment_id ) {
     136    wp_die( __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) );
     137}
     138
     139$comment = get_comment( $comment_id );
    136140
    137141/**
Note: See TracChangeset for help on using the changeset viewer.