WordPress Comments and Discussion — Complete Guide to Moderation, Spam and Engagement
In this tutorial, you'll learn to manage WordPress comments and discussions — configuring settings, moderating comments, preventing spam with Akismet, encouraging user engagement, and building a community around your content.
What You'll Learn
- How to configure Discussion Settings: default post settings, comment registration, moderation, blacklist, avatars
- How to use the Comments screen: All Comments, Pending, Approved, Spam, Trash
- How to approve, reply, edit, mark as spam, and delete comments
- How to set up the Akismet anti-spam plugin
- The comment moderation workflow: email notifications and the moderation queue
- How to disable comments per post, globally, or for specific post types
- How Gravatar works for user profile pictures
- Threaded comments settings and configuration
- How to customize the comment form with filters
- Best practices for community management
Why It Matters
Comments turn a static website into a community. Readers ask questions, share experiences, and engage with your content — and each other. But without proper management, comments become a spam nightmare. Bots post links to sketchy websites, trolls derail discussions, and genuine reader questions get buried. WordPress is the most commented-on CMS in the world, and knowing how to manage discussions effectively keeps your site engaging without overwhelming you.
Real-World Use
A popular tutorial blog receives 200+ comments per week. Without moderation, 180 would be spam (viagra ads, casino links, SEO keyword stuffing). With Akismet catching 95% of spam automatically, the moderator only reviews 10 legitimate comments per week. Of those, 7 get approved, 2 need a reply from the author, and 1 might be a question that spawns a new tutorial. The community grows, and the blog becomes the go-to resource in its niche.
Learning Path
flowchart LR
A[Image Optimization] --> B[Comments & Discussion]
B --> C[Theme Anatomy]
B --> D[Installing Themes]
Discussion Settings
Configure how comments work site-wide at Settings > Discussion.
Default Post Settings
These settings apply to new posts by default (can be overridden per post):
[ ] Allow people to submit comments on new posts
Unchecking this disables comments on all future posts. Use it when you're launching a site but not ready for community management.
[ ] Allow link notifications from other blogs (pingbacks and trackbacks)
Pingbacks notify you when another blog links to your post. Most sites disable these now because they're mostly spam.
[ ] Allow people to register and log in to comment
Forcing registration reduces spam but also reduces comments. Many sites leave this unchecked to allow anonymous comments.
Comment Moderation Settings
Comment must be manually approved → [ ]
Comment author must have a previously approved comment → [x]
A common setup: hold all comments for approval initially. Once a commenter has been approved once, their future comments appear immediately.
Hold a comment in the queue if it contains [number] or more links: 2
Comments with multiple links are almost always spam. Setting this to 2 catches most link spam automatically.
Comment Blacklist
The Comment Blacklist field holds keywords, URLs, email addresses, or IP addresses that automatically mark a comment as spam:
buy now, click here, free money, casino, viagra, http://spamsite.com
// You can also blacklist via PHP filters in functions.php
add_filter('preprocess_comment', 'blacklist_comment_keywords');
function blacklist_comment_keywords($commentdata) {
$blacklist = array('buy now', 'free money', 'casino');
foreach ($blacklist as $keyword) {
if (stripos($commentdata['comment_content'], $keyword) !== false) {
wp_die('Comment blocked: contains prohibited content.');
}
}
return $commentdata;
}
Avatar Settings
Gravatar (Globally Recognized Avatar) is a service that links an email address to a profile picture:
Avatar Display → [x] Show Avatars
Maximum Rating → [G] (suitable for all audiences)
Default Avatar → Mystery Person, Blank, Gravatar Logo, or custom image
// Add a custom default avatar in functions.php
add_filter('avatar_defaults', 'custom_default_avatar');
function custom_default_avatar($avatars) {
$custom = 'https://yoursite.com/default-avatar.png';
$avatars[$custom] = 'Site Default Avatar';
return $avatars;
}
The Comments Screen
Navigate to Dashboard > Comments to manage all comments.
Screen Tabs
| Tab | Description |
|---|---|
| All | Every comment (approved, pending, spam, trash) |
| Pending | Comments waiting for approval |
| Approved | Comments published on the site |
| Spam | Comments marked as spam |
| Trash | Deleted comments (soft delete) |
Each tab shows a count in parentheses: Pending (12).
Column Information
The Comments list shows:
| Column | Description |
|---|---|
| Author | Commenter's name and email (linked to Gravatar) |
| Comment | First few words of the comment |
| In Response To | Which post or page the comment is on |
| Submitted On | Date and time |
| Status | Unapproved, Approved, Spam, Trash |
Managing Comments
Each comment row has action links when you hover over it:
| Action | What It Does | Keyboard Shortcut |
|---|---|---|
| Approve | Approves pending comment, makes it visible | A |
| Unapprove | Reverts approved comment to pending | U |
| Reply | Opens inline reply box | R |
| Quick Edit | Edit comment content inline | E |
| Edit | Full comment editor | Shift+E |
| Spam | Marks as spam (also used to train Akismet) | S |
| Trash | Soft-deletes the comment | T |
// Programmatically moderate comments
wp_set_comment_status($comment_id, 'approve'); // Approve
wp_set_comment_status($comment_id, 'hold'); // Unapprove
wp_set_comment_status($comment_id, 'spam'); // Mark as spam
wp_delete_comment($comment_id, true); // Permanently delete
Bulk Actions
Select multiple comments and choose:
- Approve
- Unapprove
- Mark as Spam
- Move to Trash
Replying to Comments
- Hover over a comment and click "Reply"
- An inline text box appears below the comment
- Type your reply and click "Reply"
- The reply appears nested under the original comment (if threaded comments are enabled)
Akismet Anti-Spam Plugin
Akismet is an automatic spam filtering service built by the creators of WordPress. It checks every comment against a global database of spam patterns.
Setup
- Install Akismet Anti-Spam from the WordPress plugin Repository
- Click "Set up Akismet" in the plugins screen or under Settings > Akismet
- Create an Akismet account (free for personal sites, paid for commercial)
- Enter the API key
- Configure Akismet settings:
[ ] Show the number of approved comments beside each commenter's name
[x] Show a "This is spam" link on the comment form
[x] Put trash in spam for [ 15 ] days
How Akismet Works
Comment submitted → WordPress sends it to Akismet API
Akismet checks against global spam database → Returns "spam" or "ham"
Spam → Automatically moved to Spam folder
Ham → Goes to Pending (or Approved, based on settings)
Akismet Stats
In the Comments screen, a graph shows Akismet's activity:
Akismet: 1,234 spam caught since installation (last week: 156 spam)
// Check if Akismet is active and get stats
if (function_exists('akismet_get_version')) {
$stats = akismet_get_spam_count();
echo 'Akismet caught ' . $stats['spam'] . ' spam comments.';
}
Comment Moderation Workflow
A complete moderation workflow:
1. User submits comment → WordPress applies built-in filters
2. Comment checked against blacklist → If matched → Spam
3. Comment checked by Akismet → If spam → Spam folder
4. Remainder → Pending (or Approved if user was previously approved)
5. Moderator receives email notification
6. Moderator reviews Pending comments on Comments screen
7. Approve, Spam, or Trash each comment
8. If approved → Comment appears on site, user can see it
Email Notifications
WordPress sends email notifications for:
- New comment awaiting moderation (to site admin)
- Comment approved (to commenter, if configured)
// Disable moderation email notifications
add_filter('comment_moderation_recipients', '__return_empty_array');
// Change the notification email address
add_filter('comment_moderation_email_recipients', function($emails, $comment_id) {
return array('moderator@yoursite.com');
}, 10, 2);
Disabling Comments
You can disable comments at different levels:
Per Post
- Open the post in the editor
- In the Document sidebar, find the "Discussion" section
- Uncheck "Allow comments"
Globally (All Posts)
Settings > Discussion > uncheck "Allow people to submit comments on new posts"
This affects future posts only. To disable on existing posts:
-- SQL to disable comments on all existing posts
UPDATE wp_posts SET comment_status = 'closed' WHERE post_type = 'post';
For Specific Post Types
// Disable comments on pages in functions.php
add_action('init', 'disable_page_comments');
function disable_page_comments() {
remove_post_type_support('page', 'comments');
}
Via WP-CLI
# Disable comments on a specific post
wp post update 123 --comment_status=closed
# Disable comments and pingbacks on all posts
wp post list --post_type=post --format=ids | xargs wp post update --comment_status=closed --ping_status=closed
Gravatar Setup
Gravatar provides a universal profile picture linked to your email address.
For Site Visitors
Users sign up at gravatar.com with their email. When they comment on any WordPress site using that email, their Gravatar photo appears automatically.
For Site Admins
- Go to
gravatar.com - Create an account with your site's admin email
- Upload a profile photo
- The photo automatically appears next to your comments and in the WordPress admin
Custom Gravatar for Your Site
// Set a default Gravatar image for users without a Gravatar account
add_filter('avatar_defaults', 'custom_default_gravatar');
function custom_default_gravatar($defaults) {
$defaults['mystery'] = 'Mystery Person';
$defaults['blank'] = 'Blank';
$defaults['gravatar_default'] = 'Gravatar Logo';
$defaults['identicon'] = 'Identicon (Generated)';
$defaults['wavatar'] = 'Wavatar (Generated)';
$defaults['monsterid'] = 'MonsterID (Generated)';
$defaults['retro'] = 'Retro (Generated)';
return $defaults;
}
Threaded Comments Settings
Threaded (nested) comments let users reply to specific comments, creating conversations instead of flat lists.
Enable Threaded Comments
Settings > Discussion:
[ ] Enable threaded (nested) comments [5] levels deep
Common depth settings:
- 3 levels: Question → Reply → Follow-up (most common)
- 5 levels: Deep conversations, but can get confusing
- 1 level: Flat replies (like old Reddit)
// Enable threaded comments in theme's functions.php
if (comments_open()) {
wp_enqueue_script('comment-reply');
}
Why Threaded Comments Matter
Without threading:
User A: Great article!
User B: Thanks User A, I agree.
User C: Actually, I disagree with User A.
User A: User C, why do you disagree?
With threading:
User A: Great article!
└─ User B: Thanks User A, I agree.
└─ User C: Actually, I disagree with User A.
└─ User A: User C, why do you disagree?
Threading makes conversations readable.
Comment Form Customization
Customize the comment form with PHP filters:
// Modify the comment form fields
add_filter('comment_form_default_fields', 'custom_comment_fields');
function custom_comment_fields($fields) {
// Remove the website field (reduces spam)
unset($fields['url']);
// Add custom CSS classes
$fields['author'] = '<p class="form-row">' .
'<label for="author">Name <span class="required">*</span></label>' .
'<input id="author" name="author" type="text" required /></p>';
$fields['email'] = '<p class="form-row">' .
'<label for="email">Email <span class="required">*</span></label>' .
'<input id="email" name="email" type="email" required /></p>';
return $fields;
}
// Change the comment form title
add_filter('comment_form_defaults', 'custom_comment_form_defaults');
function custom_comment_form_defaults($defaults) {
$defaults['title_reply'] = 'Share Your Thoughts';
$defaults['comment_notes_before'] = '<p class="comment-notes">Your email will not be published.</p>';
$defaults['label_submit'] = 'Post Comment';
return $defaults;
}
Displaying the Comment Form in Your Theme
// In comments.php or directly in the template
if (comments_open() || get_comments_number()) {
comments_template();
}
Best Practices for Community Management
Set Clear Comment Guidelines
Display rules near the comment form:
"Be respectful. Stay on topic. No spam. We reserve the right to delete comments that violate these guidelines."
Respond Quickly
Comments left unanswered for weeks make your site look abandoned. Aim to respond within 24-48 hours.
Encourage Quality Comments
End your posts with a question: "What's your experience with this? Share in the comments below." This invites discussion.
Don't Feed the Trolls
Offensive or intentionally provocative comments should be deleted or marked as spam. Engaging with trolls encourages more bad behavior.
Reward Regular Commenters
Feature insightful comments, give "Top Commenter" badges, or mention regular contributors in follow-up posts.
// Display top commenters
function get_top_commenters($limit = 5) {
global $wpdb;
$commenters = $wpdb->get_results("
SELECT comment_author, comment_author_email, COUNT(*) as count
FROM $wpdb->comments
WHERE comment_approved = 1
GROUP BY comment_author_email
ORDER BY count DESC
LIMIT $limit
");
return $commenters;
}
Common Mistakes
Leaving comments unmoderated: A single spam comment with a malicious link can get your site blacklisted by Google. Check the pending queue daily.
Disabling comments entirely by accident: A client insists "I don't want comments" so you globally disable them — but the client later wants a comments section on the Contact page. Comments are all-or-nothing unless you configure per post type.
Not using Akismet: Without Akismet, 90%+ of your comments will be spam. The free personal license covers most blogs. Even a small amount of spam that slips through damages credibility.
Ignoring pingbacks and trackbacks: Enable these only if you actually monitor them. Most sites should disable pingbacks entirely since they're almost entirely spam.
Comment form too complex or too simple: Asking for name, email, and website is standard. Adding CAPTCHA or registration requirements reduces engagement. No moderation at all invites spam.
Practice Questions
- What's the difference between Pending, Approved, Spam, and Trash comment statuses?
- How does Akismet determine whether a comment is spam?
- Why would you disable threaded comments?
Challenge: Set up a complete comment moderation system. Install and configure Akismet. Write a comment policy. Moderate 10 real comments (find a live post or use test data) — approve 3, spam 3, trash 2, and reply to 2. Configure email notifications. Then disable comments on a specific post and verify it doesn't show the comment form.
FAQ
Mini Project
Set up a complete discussion system:
- Configure Discussion Settings: enable threaded comments (3 levels deep), hold first-time comments for approval, set blacklist with 10 common spam keywords
- Install and configure Akismet with a free API key
- Customize the comment form: remove the website field, change "Submit Comment" to "Post Comment," add a note saying "Be respectful and stay on topic"
- Write a comment policy page and link to it from the comment form
- Submit 3 test comments (one clean, one with 3 links, one with a blacklisted keyword) and verify each goes to the correct folder (Pending, Spam, Spam)
- Moderate the clean comment: approve it, reply to it, and verify it appears on the site with threading
- Create a Gravatar account and verify your profile photo appears next to your comments
What's Next
Now that you can manage community discussions, dive into Theme Anatomy to understand how WordPress themes work. Then learn Installing Themes to change your site's appearance.
For more on content management, see Writing Posts and Managing Pages.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro