Make WordPress Core

Ticket #39650: 39650-3.diff

File 39650-3.diff, 568 bytes (added by milindmore22, 9 years ago)

added after post_id check as per comment 7

  • src/wp-includes/comment-template.php

    diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
    index e97229f..2ba9403 100644
    function comment_form( $args = array(), $post_id = null ) { 
    21682168        if ( null === $post_id )
    21692169                $post_id = get_the_ID();
    21702170
     2171        //Don't show comment form if post status is not publish.
     2172        if( 'publish' !== get_post_status( $post_id ) )
     2173                return;
     2174       
    21712175        // Exit the function when comments for the post are closed.
    21722176        if ( ! comments_open( $post_id ) ) {
    21732177                /**