Do you find the fact that WordPress sets the commenting functionality on for all posts, pages, and custom post types by default annoying?
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.
[php]
function my_default_content( $post_content, $post ) {
if( $post->post_type )
switch( $post->post_type ) {
case ‘page’:
case ‘truck’:
$post->comment_status = ‘closed’;
break;
}
return $post_content;
}
add_filter( ‘default_content’, ‘my_default_content’, 10, 2 );
[/php]
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:
[php]
<?php comments_template( ”, true ); ?>
[/php]