WordPress is now commonly used as a content-management system for many websites, without any need for common blog functions. Or, the blog functions are announcement-only, comments are unwelcome.
Even if you turn off comments for all posts, the admin backend can still get polluted by robot comment requests. That’s why it’s a good idea to disable them completely when they’re not needed. This is really simple: stick this code in your ‘functions.php’ file:
// no comments!
add_action('pre_comment_on_post','bdes_die_nocomments');
function bdes_die_nocomments() {
die('No comments, please.');
}
Categories: Essentials, Snippets
No comments!
WordPress is now commonly used as a content-management system for many websites, without any need for common blog functions. Or, the blog functions are announcement-only, comments are unwelcome.
Even if you turn off comments for all posts, the admin backend can still get polluted by robot comment requests. That’s why it’s a good idea to disable them completely when they’re not needed. This is really simple: stick this code in your ‘functions.php’ file: