I'd like to enable comments for one CPT only
Hi, are you saying you want to enable comments on only one post in a custom post type, or in all posts of only one custom post type?
There are two ways to control comments. Go to Toolset > Post Types and edit the post type. Find the "Sections to display when editing" panel and enable comments using the checkbox. Repeat the process for other post types, and disable comments as needed. This enables or disables the option for comments in a single post type. For more specific comment control, follow the steps above. Then use the comments checkbox in the post editor screen to manage comments per post.
Thanks.
I did mean "in all posts of only one custom post type".
I think the solution you have given me allows users in the backend to turn on comments for a single post but what I am trying to do is allow users to create the post in the front end using a CRED form and for comments to be on by default so that others can then comment in the front end.
I understand, thanks for clarifying this. I can provide a custom code snippet that will turn comments on for all posts created by a Form. Add this code to your child theme's functions.php file, or to a new snippet in Toolset > Settings > Custom code:
add_action('cred_save_data', 'default_open_comments',10,2);
function default_open_comments($post_id, $form_data)
{
// if a specific form
$forms = array( 123,456 );
if ( in_array( $form_data['id'], $forms ) )
{
$args = array('ID' => $post_id, 'comment_status' => 'open');
wp_update_post($args);
}
}
Change 123,456 to be a comma-separated list of Form IDs where you want to enable comments for these posts. If it's only one Form, then just one number with no comma is fine.