Skip Navigation

[Resolved] Allow Comments by Default for CPT

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by MattI4840 7 months, 3 weeks ago.

Assigned support staff: Minesh.


I could just be missing it, but is there a way to allow for comments to be enabled for all posts in a cpt by default?




Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can activate the comments for the post created for your post type from;
=> Toolset => Post Types => Edit your post type => Under section "Sections to display when editing" => Checkmark the checkbox comments and save your post type.

Then with all of your posts belong to that post type there will be an option available "Allow Comments" when you create/edit the post for your post type.


Hi Minesh,

Yes I'm aware of that setting, what I'm asking for is a way to ensure that every post created for that cpt has the "allow comments" box checked off by default. So for instance when I use a post form to create a new post for a cpt, I don't see a field I can add to the form to 'allow comments' unless I'm missing something. Users of the application I'm building need to be able to leave comments for some post types, but they do not have access to the dashboard.




Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You did not mention in your initial reply that you are using forms to create the post.

Do you mean that when user create post from frontend using the Toolset post form, you want to set comment status to open for every post - correct?


For every post of a certain type yes, I already have a function that copies over fields from a parent post when this cpt is created, if there is a way for me to set comments to 'allow' in that function that would be perfect. I'm just not aware of syntax being that it's a cpt.

Sorry for not including all the info in my first post Minesh, I should have mentioned that it was a front end form creating the post and that I already have a corresponding function that fires using the 'cred_submit_complete' hook.




Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You should try to use the Toolset form's API hook: cred_save_data

You should try to add the following code to "Custom Code" section offered by Toolset:

add_action('cred_save_data', 'func_default_open_comments_for_posttype',10,2);
function func_default_open_comments_for_posttype($post_id, $form_data) {
  // if a specific form
  $forms = array( 999,888);
  if ( in_array( $form_data['id'], $forms ) ){
    $args = array('ID' => $post_id, 'comment_status' => 'open');

- Replace 999 and 888 with your original Toolset Form IDs

More info:


My issue is resolved now. Thank you!