Add Comments Form On Single Custom Post Type Pages

Generally, single pages assigned to a custom post type don’t normally include a comment form.

Update : This solution is no longer needed as Genesis now includes support for comments on all custom post types.

You may find code in the single CPT template file which removes the comments form which you can remove.

//* Remove the comments template
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );

Otherwise there’s 2 ways to add support for comments to custom post type pages.

Paste this code at the end of your child themes functions.php file:

add_post_type_support( 'portfolio', 'comments' );

Simply change the name from portfolio in the code to the name of your custom post type (CPT).

For non Genesis users, you can use this code in your functions file:

function enable_comments_custom_post_type() {
 add_post_type_support( 'portfolio', 'comments' );
}
add_action( 'init', 'enable_comments_custom_post_type', 11 );

Second Option

Add support for comments to your existing CPT code in your functions file: Example:

In the code block above, you can add comments to the array your CPT supports.

'supports'     => array( 'comments',

Now you should find comments are supported in the backend Edit Page of all your single CPT’s.

comments

The only problem is, the actual comment form may not be displaying.

The reason for this is, you also need to enable comments manually on each single CPT regardless of your Discussion settings.

allow comments

Once you do this, you will then see the comment form on your single custom post type pages.

Related Code Snippets


Comments

3 responses to “Add Comments Form On Single Custom Post Type Pages”

  1. […] » Visit Now Add Comments Form On Single Custom Post Type Pages Generally, single pages assigned to a custom post type don’t normally include a comment form. Update : This solution is no longer needed as Genesis now includes support for comments on all custom post types. […]

  2. […] Add Comments Form On Single Custom Post Type Pages […]

  3. Heidi Bender Avatar
    Heidi Bender

    This was exactly what I needed. thank you!!!

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.