I want to enable comments for custom post types just like they are for standard posts, but can't seem to get it to work.
In functions.php, as part of registering my custom post type, I have this:
'supports' => array('title', 'author', 'thumbnail', 'comments', 'revisions'),
In my single post type template I have this:
<?php comments_template( '', true ); ?>
But on the edit screen "allow comments" is un-checked by default which results in a "comments are closed" message on the front end. When I check "allow comments" then comments are enabled on the front end, but I really don't want to tell my client he has to manually check that box for every new post.
I tried the recommendations here:
Why are the comments disabled by default on my custom_post_types?
But it didn't work for me.
I tried disabling all plugins. Didn't work.
Using WP 3.6.
Any suggestions? Thanks in advance.
I want to enable comments for custom post types just like they are for standard posts, but can't seem to get it to work.
In functions.php, as part of registering my custom post type, I have this:
'supports' => array('title', 'author', 'thumbnail', 'comments', 'revisions'),
In my single post type template I have this:
<?php comments_template( '', true ); ?>
But on the edit screen "allow comments" is un-checked by default which results in a "comments are closed" message on the front end. When I check "allow comments" then comments are enabled on the front end, but I really don't want to tell my client he has to manually check that box for every new post.
I tried the recommendations here:
Why are the comments disabled by default on my custom_post_types?
But it didn't work for me.
I tried disabling all plugins. Didn't work.
Using WP 3.6.
Any suggestions? Thanks in advance.
I made no additional changes, but somehow it's working correctly now. Perhaps the system had to sleep on it or something, but when I checked again this morning everything was working properly.
I believe that these instructions do work:
Why are the comments disabled by default on my custom_post_types?
Essentially kick-starting the comments in SETTINGS > DISCUSSION
, much like clicking "save changes" in SETTINGS > PERMALINKS
resets the system if you run into a 404 after registering custom post types.
Check your settings in discussion
1) Dashboard -> Settings -> Discussion -> Default article settings -> 'Allow people to post comments on new articles' should be checked.
By settings this you will get 'Allow comments' default selected.
please try to modify your custom post-type registration code to enable comments by default.
By setting 'comments' => true
in the arguments array, comments will be enabled by default for your custom post type.
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'your-post-type' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
'comments' => true, // Enable comments by default
);
register_post_type( 'your_post_type', $args );