Disabling Comments Globally :: Have you been getting tons of comment spam, those pesky comments that talk more abut Gucci bags than the do about any of your website or blog subjects? Did you know that commenting ability can be disabled (or hidden or turned off, however you wanna couch it). Here is a quick tutorial about managing comments for WordPress websites and or blogs, either globally or on a per page and or per post basis.
Comment management in WordPress is is not theme related – turning off comments is a WordPress feature that is just a bit hidden at first and not very well documented. It will work no matter what theme you’re using.
Disable WordPress Commenting Globally
Navigate to your website or blogs admin; the WordPress Dashboard, next in the left navigation panel find Settings =>Discussion . Find the option on the ensuing scree “Allow people to post comments on new articles”. This setting is checked by default. You can un-check this option to turn off entirely; well, with some noted exceptions.
Posts and or pages that have already been written before the time you change this option will remain unaffected.
Spam Bots that find your website theme’s comment form and auto submit it even though it has been hidden from public view.
Turn Off Comments for Already Published Pages/Posts
Using Quick Edit
By displaying the list of pages or posts, one can easily use quick edit to change the WordPress commenting behavior on a per page/post basis.
More advanced users can globally effect all pages and posts that you do not want comments or pings / trackbacks displaying by using SQL via phpMyAdmin or other database modification tool.
Below are the simple SQL commands to disable comments, pings / trackbacks across an entire WordPress site.
Disabling Pings and Trackbacks
The SQL commands below changes the “ping_status” field of published posts & pages to “closed”. Notice that there is a separate SQL statement for each post type. If you had custom post types you would need to issue SQL commands for each post type by changing the “post_type” variable to the applicable custom post type.
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
The SQL commands below changes the “comment_status” field of published posts & pages to “closed”. This is similar to the SQL statement above for disabling pings / trackbacks in that you will need to issue the SQL command for both the post and page post type plus any other custom post types you have defined.
UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
With four simple SQL queries you can disable comment, pings, and trackbacks across your entire WordPress site.
Find Attachment Comments
If you find your media file attachments are being targeted by spam comments then here is the solution for you.
Get the WordPress Plugin
Disabling Comments Per Post/Page
But most of you probably want greater power. You want micromanagement. You wanna choose one by one the pages or posts that have comments enabled. Well, that’s very easy. The option has been there all along, only that it’s not visible. Yet…
Either create a a new post or page, or edit an existing one and then, in the top right corner of your page look for the Screen Options tab. Click on it to reveal a host of hidden options. The option related to WordPress discussion/commenting is titled “Discussion” and it is not enabled by default. Enable this option and then below the page/post content editor a new meta box will be revealed as pictured below:
Un-checking the Allow Comments check box will turn off commenting – hide the Add a Comment form for individual pages or posts.
A Plugin Solution
While I often caution about excessive plugin use, if you are not an offender you may want to go this route. Please be aware that any plugin may conflict with your theme’s code or with other plugins, now or in the future given WordPress core and plugin updates that are sure to occur.
The Disable Comments plugin will allow a site administrator to globally disable all comments, including pingbacks and trackbacksLear more from the WordPress codex. Comments can be disabled for specific post types only – posts, pages, or attachment pages. The plugin’s effects are reversible simply by disabling the checked options.