WordPress Comment Moderation
Comments are a powerful way to engage with your visitors and build community on your WordPress site. However, without proper moderation, comments can become a source of spam, inappropriate content, or security vulnerabilities. In this guide, we'll explore how to effectively manage and moderate comments on your WordPress website.
Understanding WordPress Comment System
WordPress comes with a built-in comment system that allows visitors to leave feedback on your posts and pages. By default, comments are enabled on all posts but can be configured globally or on a per-post basis.
The Importance of Comment Moderation
Comment moderation is crucial for several reasons:
- Spam Prevention - Unmoderated sites quickly become targets for automated spam comments
- Content Quality - Ensures discussions remain relevant and valuable
- Site Reputation - Protects your site's professional appearance
- User Experience - Creates a safer, more pleasant environment for genuine visitors
- SEO Considerations - Prevents spam links that could harm your search rankings
Configuring Comment Settings
Before diving into specific moderation techniques, let's configure the basic comment settings in WordPress.
Basic Comment Settings
Navigate to Settings → Discussion in your WordPress dashboard to access the main comment configuration options.
Key settings include:
- Default article settings - Control whether to allow comments on new posts
- Other comment settings - Configure comment author requirements
- Email me whenever - Notification settings for new comments
- Before a comment appears - Moderation and approval settings
- Comment Moderation - Keywords and rules for automatic moderation
- Disallowed Comment Keys - Words that trigger automatic rejection
Here's an example of recommended settings for beginners:
✓ Allow people to submit comments on new posts
✓ Comment author must fill out name and email
✓ Comment author must have a previously approved comment
✓ Comment must be manually approved
Enabling Threaded Comments
Threaded comments allow visitors to reply directly to specific comments, creating organized discussions:
// In your theme's functions.php file, ensure threaded comments are supported
function theme_setup() {
// Add support for threaded comments
add_theme_support('threaded-comments');
}
add_action('after_setup_theme', 'theme_setup');
Manual Moderation Techniques
The Comments Dashboard
Access your comments by clicking on "Comments" in the WordPress dashboard sidebar. Here, you'll see:
- Pending - Comments awaiting moderation
- Approved - Published comments
- Spam - Comments marked as spam
- Trash - Deleted comments (can be restored)
Available Actions for Each Comment
When you hover over a comment, several options appear:
- Approve - Publish the comment
- Reply - Respond to the comment
- Quick Edit - Make changes to the comment content
- Edit - Open the full comment editor
- History - View the comment's moderation history
- Spam - Mark as spam (helps train spam filters)
- Trash - Move to trash
Bulk Moderation
To save time, you can moderate multiple comments at once:
- Check the boxes next to the comments you want to moderate
- Select an action from the "Bulk Actions" dropdown
- Click "Apply"
Automated Moderation Techniques
Using Comment Moderation Keywords
WordPress can automatically flag comments containing specific words for moderation:
- Go to Settings → Discussion
- Scroll to "Comment Moderation"
- Add keywords one per line (comments containing these will be held for moderation)
Example moderation keywords:
http://
casino
viagra
loan
Using Comment Blacklist Keywords
Comments containing blacklisted keywords are automatically sent to the spam folder:
- Go to Settings → Discussion
- Scroll to "Disallowed Comment Keys" (or "Comment Blacklist" in older versions)
- Add keywords one per line
Example blacklist keywords:
porn
seo service
free money
Implementing Akismet for Spam Protection
Akismet is a powerful anti-spam plugin that comes pre-installed with WordPress. It automatically checks comments against its database of spam patterns.
Setting Up Akismet
- Activate the Akismet plugin from Plugins → Installed Plugins
- Click on "Set up your Akismet account"
- Sign up for an API key (free for personal blogs, paid for commercial sites)
- Enter your API key in the Akismet settings
Akismet works silently in the background, but you can review its activity:
Last 24 hours: 35 spam blocked
Total: 12,456 spam blocked
Accuracy: 99.7%
Moderating Comments Programmatically
For developers, WordPress offers hooks to customize the comment moderation process.
Pre-filtering Comments
// Reject comments with certain patterns
add_filter('pre_comment_approved', 'custom_comment_moderation', 99, 2);
function custom_comment_moderation($approved, $comment_data) {
// Block comments with more than 3 links (often spam)
$pattern = '/http/';
$num_links = preg_match_all($pattern, $comment_data['comment_content']);
if ($num_links > 3) {
return 'spam';
}
// Block comments that are too short
if (strlen($comment_data['comment_content']) < 5) {
return 0; // 0 = hold for moderation
}
return $approved;
}
Adding Custom Notification for New Comments
// Send notifications to additional email addresses
add_filter('comment_notification_recipients', 'custom_comment_notification', 10, 2);
function custom_comment_notification($emails, $comment_ID) {
// Add another email address to receive notifications
$emails[] = '[email protected]';
return $emails;
}
Best Practices for Comment Moderation
Create a Comment Policy
A clear comment policy helps set expectations for your visitors:
<!-- Example Comment Policy HTML to add to your pages -->
<div class="comment-policy">
<h4>Comment Policy</h4>
<p>We welcome thoughtful and respectful comments. Please note:</p>
<ul>
<li>All comments are moderated before publishing</li>
<li>Spam and promotional content will be removed</li>
<li>Be respectful to others – personal attacks will not be tolerated</li>
<li>Keep comments relevant to the post topic</li>
</ul>
</div>
Consistent Moderation Schedule
Establish a regular schedule for comment moderation to avoid backlogs:
Using CAPTCHA to Reduce Spam
Adding a CAPTCHA system can significantly reduce automated spam. Popular options include:
- reCAPTCHA - Google's service
- hCaptcha - Privacy-focused alternative
- Simple math problems - Lightweight option
Advanced Comment Features
Comment Rating Systems
Enhance your comments with rating functionality:
// Simple comment rating functionality
add_action('comment_form_logged_in_after', 'comment_rating_field');
function comment_rating_field() {
echo '<p class="comment-form-rating">
<label for="rating">Rating</label>
<select name="rating" id="rating">
<option value="">Rate this article</option>
<option value="5">Excellent</option>
<option value="4">Good</option>
<option value="3">Average</option>
<option value="2">Below Average</option>
<option value="1">Poor</option>
</select>
</p>';
}
// Save the rating
add_action('comment_post', 'save_comment_rating');
function save_comment_rating($comment_id) {
if (isset($_POST['rating'])) {
add_comment_meta($comment_id, 'rating', esc_attr($_POST['rating']));
}
}
Highlighting Author Comments
Make your own comments stand out:
/* Add to your theme's CSS */
.bypostauthor {
background: #f8f8f8;
border-left: 3px solid #0073aa;
padding-left: 10px;
}
Troubleshooting Common Issues
Comments Not Appearing
If legitimate comments aren't appearing:
- Check your Discussion settings
- Verify if the comment was caught by spam filters
- Ensure the post has comments enabled
- Check if the commenter was previously blocked
Excessive Spam Despite Protections
If you're still getting too much spam:
- Consider temporarily disabling comments on older posts
- Add more strict moderation keywords
- Implement a more robust CAPTCHA solution
- Consider a premium anti-spam solution
Summary
Effective comment moderation is essential for maintaining a healthy, engaging WordPress site. By combining WordPress's built-in tools with plugins like Akismet and implementing clear policies, you can create a vibrant comment section that adds value to your content while keeping spam and inappropriate content at bay.
Remember that comment moderation is an ongoing process that should evolve with your site's needs. Regular maintenance and attention to your comment section will help foster a positive community around your content.
Additional Resources
- WordPress Codex: Discussion Settings
- Akismet Documentation
- WordPress Comment Moderation APIs
Exercises
- Set up your comment moderation settings following the recommendations in this guide.
- Create and publish a comment policy on your website.
- Install and configure Akismet.
- Review your existing comments for spam and legitimate content.
- Implement at least one programmatic comment moderation technique on your site.
If you spot any mistakes on this website, please let me know at [email protected]. I’d greatly appreciate your feedback! :)