WordPress.org

Make WordPress Core

Ticket #19739: 19739.2.diff

File 19739.2.diff, 1.2 KB (added by chriscct7, 5 years ago)

Second patch

  • 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        /**
     40         * Allow comments on trashed posts.
     41         *
     42         * Allow comments on trashed posts, per #19739.
     43         *
     44         * @since 4.1.0
     45         *
     46         * @param int  $comment_post_ID The post_id for comments to be enabled on.
     47         */
     48        if ( !apply_filters( 'allow_comment_on_trash', false, $comment_post_ID ) ){
     49                exit;
     50        }
    4051} elseif ( !$status_obj->public && !$status_obj->private ) {
    4152        do_action('comment_on_draft', $comment_post_ID);
    42         exit;
     53        /**
     54         * Allow comments on draft posts.
     55         *
     56         * Allow comments on draft posts, per #19739.
     57         *
     58         * @since 4.1.0
     59         *
     60         * @param int  $comment_post_ID The post_id for comments to be enabled on.
     61         */
     62        if ( !apply_filters( 'allow_comment_on_draft', false, $comment_post_ID ) ){
     63                exit;
     64        }
    4365} elseif ( post_password_required($comment_post_ID) ) {
    4466        do_action('comment_on_password_protected', $comment_post_ID);
    4567        exit;