Skip Navigation

[Resolved] Disabling Comments for a Post Type or in a Layout

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 2 replies, has 2 voices.

Last updated by aaronM-9 1 year, 6 months ago.

Assigned support staff: Nigel.

Author
Posts
#1559149

Can you explain how I can disable comments on a particular post type? I thought there was a setting in Layouts to do this but I can't seem to find it. When the user is logged in, I don't want it to allow or display comments for any posts under the post type "Brands". I'm using Astra as my theme. Thanks for any help.

- Aaron

#1559711

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Support for comments is specified in the settings for a custom post type, which you can adjust at Toolset > Post Types when editing the post type in question, and they are output by your theme, Toolset doesn't otherwise affect them.

But the way support for comments works is a little odd. If enabled, it allows you to enable/disable comments on individual posts.

If you revoke support for comments on a post type that has it, then it will simply remove the ability to turn on/off comments on individual posts, but it won't remove comments or the comment form from posts which previously had it, and there is nowhere in the settings you can readily do that.

If it is the case that you created a custom post type and enabled comments support, published some posts where comments are enabled, and now want to remove the comments UI, you could re-enable comments support for the post type and then edit each of the posts (or bulk edit) and disable the comments post-by-post.

If you already have a lot of such content the easiest solution may be to copy the single.php theme template to a more specific template for your post type, e.g. single-my-cpt.php, and then edit that template to remove the part which outputs the comments. (This assumes the theme doesn't offer such options to disable the comments.)

#1560629

Thanks - I ran a SQL query to close all comments.

- Aaron