WordPress.org

Make WordPress Core

Ticket #19739: 19739.diff

File 19739.diff, 769 bytes (added by cyberhobo, 6 years ago)

Added a post id parameter and similar filter for comments on trashed posts.

  • wp-comments-post.php

     
    3636        wp_die( __('Sorry, comments are closed for this item.') );
    3737} elseif ( 'trash' == $status ) {
    3838        do_action('comment_on_trash', $comment_post_ID);
    39         exit;
     39        if ( apply_filters( 'deny_comment_on_trash', true, $comment_post_ID ) )
     40                exit;
    4041} elseif ( !$status_obj->public && !$status_obj->private ) {
    4142        do_action('comment_on_draft', $comment_post_ID);
    42         exit;
     43        if ( apply_filters( 'deny_comment_on_draft', true, $comment_post_ID ) )
     44                exit;
    4345} elseif ( post_password_required($comment_post_ID) ) {
    4446        do_action('comment_on_password_protected', $comment_post_ID);
    4547        exit;