_close_comments_for_old_posts [ WordPress Function ]
_close_comments_for_old_posts ( $posts, $query )
| Access: |
|
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: _close_comments_for_old_post, wp_set_comment_status, get_comment_author_rss, wp_set_comment_cookies, check_comment_flood_db
Close comments on old posts on the fly, without any extra DB queries. Hooked to the_posts.
Source
<?php
function _close_comments_for_old_posts( $posts, $query ) {
if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
return $posts;
$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
if ( ! in_array( $posts[0]->post_type, $post_types ) )
return $posts;
$days_old = (int) get_option( 'close_comments_days_old' );
if ( ! $days_old )
return $posts;
if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) {
$posts[0]->comment_status = 'closed';
$posts[0]->ping_status = 'closed';
}
return $posts;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- #18109 (is_singular is being called on - WordPress Trac
is_singular is being called on _close_comments_for_old_posts ... Pass the query object to _close_comments_for_old_posts() so that is_singular is checked for ...
core.trac.wordpress.org - #16090 (_close_comments_for_old_posts should not close pages ...
Description. _close_comments_for_old_posts should do a check on the post_type and not apply itself to Pages. Attachments. 16090.diff · Download (484 bytes) ...
core.trac.wordpress.org - _close_comments_for_old_posts (WordPress Function) - WPSeek ...
WordPress lookup for _close_comments_for_old_posts, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme ...
wpseek.com - Law of Attraction : Law Of Attraction
Discover the missing puzzle of. "The Secret". The Law Of Attracting Your Goals. Just enter your name and email to receive this Absolutely FREE Exclusive 20 ...
attractingyourgoals.com