0

I don't get this at all. I've looked online and I think I did everything I was supposed to, but my custom post type does not display a comments form.

In functions.php. where I define the post type I have: 'supports' => array('title','editor','thumbnail', 'excerpt', 'comments'),

(note: the 'comments' string wasn't there when the posts where made, I added it just now trying to fix this)

In the single-mytype.php I added <?php comments_template('comments.php'); ?> to the loop. note: before I added the filename, I got nothing but now I get a "comments are closed" slug.

If I edit the post, I see "enable comments" and "enable trackbacks" are unchecked, but if I check them they won't stay checked.

If I check "enable comments" and add a comment to the admin form, that comment will be displayed... but no form for other comments.

What am I missing here?

  • Did you check the Settings > Discussion section for the "Automatically close comments ..." option? – A.Jesin Aug 28 '14 at 19:30
  • yes, it's unchecked. – Steve Aug 28 '14 at 19:43
  • Create a new post under this post type and see if it the comment form appears. Also try switching to a bundled theme like Twenty Fourteen and check the results. – A.Jesin Aug 28 '14 at 20:14
0

Wordpress, by default don't enable comments on custom post types, and once you have added support for comments, you still get the following message: Comments are closed

You have to basically manually visit each custom post and enable comments in the post editor screen.

There are however a workaround to enable comments by default in bulk. You can use the following snippet to enable comments in bulk

function switch_on_comments_automatically(){
    global $wpdb;
    $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_status = 'open'")); // Switch comments on automatically
} 
  • Just checking in to see what is the status of your problem, is it resolved yet. If my answer solved your issue, please consider accepting my answer. If mine did not meet your standards and you manage to resolve this issue yourself, please consider posting and accepting your own answer. Would be nice to know how you've resolved this :-) – Pieter Goosen Aug 31 '14 at 3:42
  • We were off for an extended Labor Day weekend here in the USA so I did not get to try your solution until I got back to work today. It works, but we might want to add that I needed to of course call the function once added to functions.php: switch_on_comments_automatically(); – Steve Sep 2 '14 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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