How to Disable commenting on posts by default

Do you find the fact that WordPress sets the commenting functionality on for all posts, pages and custom post types by default? Now we have a solution to that, just add the following to your functions.php file, paying attention to the switch conditions. Here we are disabling commenting on all new pages and ‘truck’ custom post types. Edit those as you require.

Note that this will only disable commenting for new pages and posts and not on those you have already created. For those you will have to manually change the comment settings from the Edit Post/Page interface.

As an alternative to editing your functions.php, you can go for this plugin which disables commenting by default on Pages: Page Comments Off Please.

Yet another simple alternative is to remove or comment out the code in your page template (page.php) relating to the comment form. In the default TwentyTen theme this looks something like:

About Jean Galea

Jean Galea is a WordPress developer and creator of the WP RSS Aggregator plugin. He loves blogging and is the founder of WP Mayor. Jean also blogs about internet marketing at Fit for Blogging.

Leave a Reply