I have a custom post type. I have the Comments box unchecked in the Post type settings "Sections to display when editing" in the Toolset settings. I have comments disabled in the general WordPress settings. Yet, there is a Leave a comments box on the front end of this post type. How do I get rid of it? I don't want comments on it. There are no comments, the site isn't live. I don't see anywhere else to entirely disable comments on the post type created with Toolset.
To disable comments from new and existing posts in a particular post type, you can follow these steps:
1. Please make sure that the "Comments" option is enabled in that post type's settings.
( example screenshot: hidden link )
2. Next, go to the post list of this post type in the admin area, and use bulk edit option to set comments to "Do not allow" for all existing posts.
( example screenshot: hidden link )
3. Once comments have been disabled for all existing posts, you can disable the comment option for this post type that was mentioned in step 1, so that they can't be turned on for future posts.
If it doesn't work, can you please try adding the following code to your theme's functions.php file? This should forcefully disable the comment section based on the CPT you select in the code.
add_action( 'template_redirect', 'pp_disable_comments' );
function pp_disable_comments($post_object) {
global $post;
$obj = get_post_type_object($post_object);
// test CPT
if ($post->post_type == 'post') {
// disable comment section
$post->comment_status="closed";
}
}
I hope this helps and please let me know if you need any further assistance around this.
Thanks, Mateus.
I don't understand why they would be allowed/displayed in the first place if I have that first setting you mentioned unchecked from the beginning as well as the main Discussion settings in admin set to unchecked for allow comments. So why would I have to go through those steps of turning them on and off if they were unchecked from the beginning?
I used the snipped in this link which worked to turn them off always hidden link
But I'd like to understand in general why a new post type wouldn't respect the do not allow comments choices in both admin and Toolset settings?
This situation could happen mainly due to one of the two issues:
1 - Another plugin(like the one you just installed) or your theme could be overriding Toolset's comments setting for your CPTs. To check this you can test in minimal environment with a default theme and all non-Toolset plugins disabled.