0

I have several different custom post types. One post type did not display the comment section, today I found out it was because I forgot to add it to the "supports array"

'supports'=>array('title','editor','revisions','thumbnail','excerpt','custom-fields','author')

So today I updated that line to:

'supports'=>array('title','editor','revisions','thumbnail','excerpt','custom-fields','author','comments')

However the comment section is still not appearing.. How do I force the page to be regenerated? (if that's the issue, idk)

I'm using disqus as comment system and the code to display the comments is exactly the same in other pages, so it should work.

1
  • where are you checking frontend or backend? Aug 11, 2015 at 13:32

1 Answer 1

0

You can use a function called add_post_type_support

Hook into init after the post types have been created, and add support for comments.

add_action('init', 'my_cpt_add_excerpt', 100);
function my_cpt_add_excerpt() {
    add_post_type_support('mycpt', 'excerpt');
}

...where mycpt is the name of your custom post type.

If you want to do it cleanly, you can always deregister the custom post type, and then register it again with the corrected supports array.

Further reading: http://codex.wordpress.org/Function_Reference/add_post_type_support

1
  • I'd prefer the clean method, but isn't deregistering your custom post type a big risk? We already have dozens of posts in that custom post type.
    – vlovsky
    Aug 11, 2015 at 13:43

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.