_close_comments_for_old_post [ WordPress Function ]
_close_comments_for_old_post ( $open, $post_id )
| Access: |
|
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: _close_comments_for_old_posts, check_comment_flood_db, wp_set_comment_cookies, post_comments_feed_link, is_comments_popup
Close comments on an old post. Hooked to comments_open and pings_open.
Source
<?php
function _close_comments_for_old_post( $open, $post_id ) {
if ( ! $open )
return $open;
if ( !get_option('close_comments_for_old_posts') )
return $open;
$days_old = (int) get_option('close_comments_days_old');
if ( !$days_old )
return $open;
$post = get_post($post_id);
$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
if ( ! in_array( $post->post_type, $post_types ) )
return $open;
if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
return false;
return $open;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- #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 - Projects - Badi Jones
... add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 ); add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 ); add_filter( ...
www.badijones.com