0

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.

1
  • It's looking strange and as you have said you have tried all recommendations from this question wordpress.stackexchange.com/questions/38405/… Can you just copy your custom post type registration code from functions.php file and add it into another theme line twentythirteen and check whether the same happens or not? Commented Aug 24, 2013 at 8:59

3 Answers 3

0

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.

1
  • 2
    Tried this without success.
    – atwellpub
    Commented Mar 31, 2014 at 22:07
0

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.

0

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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.