WordPress.org

Make WordPress Core

Changeset 18087


Ignore:
Timestamp:
06/01/2011 02:24:02 PM (7 years ago)
Author:
westi
Message:

Only close comments on old posts by default. Fixes #16090 props nacin and johnjamesjacoby.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r17928 r18087  
    19661966        return $posts;
    19671967
     1968    $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
     1969    if ( ! in_array( $posts[0]->post_type, $post_types ) )
     1970        return $posts;
     1971
    19681972    $days_old = (int) get_option('close_comments_days_old');
    19691973    if ( !$days_old )
     
    20012005    $post = get_post($post_id);
    20022006
     2007    $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
     2008    if ( ! in_array( $post->post_type, $post_types ) )
     2009        return $open;
     2010
    20032011    if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
    20042012        return false;
Note: See TracChangeset for help on using the changeset viewer.