[wp-trac] [WordPress Trac] #19929: Automatically close comments after X days: Doesn't work with custom post types
WordPress Trac
wp-trac at lists.automattic.com
Mon Jan 30 14:36:28 UTC 2012
#19929: Automatically close comments after X days: Doesn't work with custom post
types
--------------------------+-----------------------------
Reporter: ndoherty13 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 3.3.1
Severity: normal | Keywords:
--------------------------+-----------------------------
In the discussion settings you can set comments to close after X days.
This works for regular posts, but not for custom post types. The comments
on the latter stay open regardless.
Issue experienced on two separate WordPress installations, one of which
had all plugins disabled and was using the default TwentyEleven theme.
To recreate the issue follow these steps:
'''1.''' Register a custom post type in the theme's functions.php file
using the following code...
{{{
add_action( 'init', 'create_post_type_1' );
function create_post_type_1() {
register_post_type( 'book_reviews',
array(
'labels' => array(
'name' => __( 'Book Reviews' ),
'singular_name' => __( 'Book Review' ),
'all_items' => __( 'All Reviews' ),
'add_new_item' => __( 'Add New Book
Review' ),
'edit_item' => __( 'Edit Book Review' ),
'view_item' => __( 'View Review' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'book-reviews'),
'supports' => array(
'title',
'editor',
'author',
'thumbnail',
'excerpt',
'trackbacks',
'custom-fields',
'comments',
'revisions'
),
'taxonomies' => array('post_tag')
)
);
}
}}}
'''2.''' In your site's discussion settings, set comments to automatically
close after 1 day.
'''3.''' Publish a regular blog post and a custom post type (CPT) post.
'''4.''' Check back in 24 hours and you'll find that the comments on the
regular post are now closed, while the comments on the CPT post remain
open.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19929>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list