Make WordPress Core

Changeset 18836


Ignore:
Timestamp:
09/30/2011 03:35:50 PM (13 years ago)
Author:
ryan
Message:

Pass the query object to _close_comments_for_old_posts() so that is_singular is checked for the proper query. Props kawauso. fixes #18109

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r18087 r18836  
    19601960 *
    19611961 * @param object $posts Post data object.
     1962 * @param object $query Query object.
    19621963 * @return object
    19631964 */
    1964 function _close_comments_for_old_posts( $posts ) {
    1965     if ( empty($posts) || !is_singular() || !get_option('close_comments_for_old_posts') )
     1965function _close_comments_for_old_posts( $posts, $query ) {
     1966    if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
    19661967        return $posts;
    19671968
     
    19701971        return $posts;
    19711972
    1972     $days_old = (int) get_option('close_comments_days_old');
    1973     if ( !$days_old )
     1973    $days_old = (int) get_option( 'close_comments_days_old' );
     1974    if ( ! $days_old )
    19741975        return $posts;
    19751976
  • trunk/wp-includes/default-filters.php

    r18809 r18836  
    190190add_filter( 'option_tag_base',          '_wp_filter_taxonomy_base'            );
    191191add_filter( 'option_category_base',     '_wp_filter_taxonomy_base'            );
    192 add_filter( 'the_posts',                '_close_comments_for_old_posts'       );
     192add_filter( 'the_posts',                '_close_comments_for_old_posts', 10, 2);
    193193add_filter( 'comments_open',            '_close_comments_for_old_post', 10, 2 );
    194194add_filter( 'pings_open',               '_close_comments_for_old_post', 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.