WordPress.org

Make WordPress Core

Ticket #12529: 12529.001.diff

File 12529.001.diff, 1.6 KB (added by aaroncampbell, 4 years ago)
  • wp-comments-post.php

     
    3030 
    3131if ( !comments_open($comment_post_ID) ) { 
    3232        do_action('comment_closed', $comment_post_ID); 
    33         wp_die( __('Sorry, comments are closed for this item.') ); 
     33        wp_die( __('Sorry, comments are closed for this item.'), '', array( 'response' => 403 ) ); 
    3434} elseif ( 'trash' == $status->post_status ) { 
    3535        do_action('comment_on_trash', $comment_post_ID); 
    3636        exit; 
     
    6565        } 
    6666} else { 
    6767        if ( get_option('comment_registration') || 'private' == $status->post_status ) 
    68                 wp_die( __('Sorry, you must be logged in to post a comment.') ); 
     68                wp_die( __('Sorry, you must be logged in to post a comment.'), '', array( 'response' => 401 ) ); 
    6969} 
    7070 
    7171$comment_type = ''; 
    7272 
    7373if ( get_option('require_name_email') && !$user->ID ) { 
    7474        if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 
    75                 wp_die( __('Error: please fill the required fields (name, email).') ); 
     75                wp_die( __('Error: please fill the required fields (name, email).'), '', array( 'response' => 200 ) ); 
    7676        elseif ( !is_email($comment_author_email)) 
    77                 wp_die( __('Error: please enter a valid email address.') ); 
     77                wp_die( __('Error: please enter a valid email address.'), '', array( 'response' => 200 ) ); 
    7878} 
    7979 
    8080if ( '' == $comment_content ) 
    81         wp_die( __('Error: please type a comment.') ); 
     81        wp_die( __('Error: please type a comment.'), '', array( 'response' => 200 ) ); 
    8282 
    8383$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 
    8484