WordPress.org

Make WordPress Core

Ticket #11810: no-comments-on-non-accessible-posts.11810.diff

File no-comments-on-non-accessible-posts.11810.diff, 879 bytes (added by filosofo, 4 years ago)
  • wp-comments-post.php

     
    2727} elseif ( !comments_open($comment_post_ID) ) { 
    2828        do_action('comment_closed', $comment_post_ID); 
    2929        wp_die( __('Sorry, comments are closed for this item.') ); 
    30 } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { 
     30} elseif ( in_array($status->post_status, array('draft', 'future', 'pending') ) ) { 
    3131        do_action('comment_on_draft', $comment_post_ID); 
    3232        exit; 
    3333} elseif ( 'trash' == $status->post_status ) { 
    3434        do_action('comment_on_trash', $comment_post_ID); 
    3535        exit; 
     36} elseif ( post_password_required($comment_post_ID) ) { 
     37        do_action('comment_on_password_protected', $comment_post_ID); 
     38        exit; 
    3639} else { 
    3740        do_action('pre_comment_on_post', $comment_post_ID); 
    3841}