WordPress.org

Make WordPress Core

Ticket #19739: 19739.3.diff

File 19739.3.diff, 1.3 KB (added by chriscct7, 5 years ago)

Move action inside per slack chat

  • wp-comments-post.php

     
    3636        wp_die( __('Sorry, comments are closed for this item.') );
    3737} elseif ( 'trash' == $status ) {
    38         do_action('comment_on_trash', $comment_post_ID);
    39         exit;
     38        /**
     39         * Allow comments on trashed posts.
     40         *
     41         * Allow comments on trashed posts, per #19739.
     42         *
     43         * @since 4.1.0
     44         *
     45         * @param int  $comment_post_ID The post_id for comments to be enabled on.
     46         */
     47        if ( !apply_filters( 'allow_comment_on_trash', false, $comment_post_ID ) ){
     48                do_action('comment_on_trash', $comment_post_ID);
     49                exit;
     50        }
    4051} elseif ( !$status_obj->public && !$status_obj->private ) {
    41         do_action('comment_on_draft', $comment_post_ID);
    42         exit;
     52        /**
     53         * Allow comments on draft posts.
     54         *
     55         * Allow comments on draft posts, per #19739.
     56         *
     57         * @since 4.1.0
     58         *
     59         * @param int  $comment_post_ID The post_id for comments to be enabled on.
     60         */
     61        if ( !apply_filters( 'allow_comment_on_draft', false, $comment_post_ID ) ){
     62                do_action('comment_on_draft', $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;