Make WordPress Core

Ticket #39650: 39650-1.diff

File 39650-1.diff, 634 bytes (added by milindmore22, 9 years ago)

Patch will not show comment form if post status is not publish. The patch will also take care of pending status.

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

    diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
    index e97229f..37e5acb 100644
    function wp_list_comments( $args = array(), $comments = null ) { 
    21652165 * @param int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post.
    21662166 */
    21672167function comment_form( $args = array(), $post_id = null ) {
     2168        //Don't show comment form if post status is not publish.
     2169        if( 'publish' !== get_post_status( $post ) )
     2170                return;
     2171       
    21682172        if ( null === $post_id )
    21692173                $post_id = get_the_ID();
    21702174