How do I add Webmentions to WordPress?
Complete guide to implementing Webmentions on WordPress sites using plugins and custom solutions.
WordPress is one of the easiest platforms for adding Webmention support, thanks to excellent plugins from the IndieWeb community. You can be up and running in under 10 minutes.
Quick Start: Plugin Installation
Step 1: Install the Webmention Plugin
The official Webmention plugin handles receiving and sending:
- Go to Plugins → Add New
- Search for "Webmention"
- Install and activate the plugin by Matthias Pfefferle
That's it! Your site can now receive Webmentions.
Step 2: Install Semantic Linkbacks (Recommended)
The Semantic Linkbacks plugin displays mentions with rich context:
- Search for "Semantic Linkbacks"
- Install and activate
- Works automatically with the Webmention plugin
Now mentions will show author photos, names, and formatted content.
Step 3: Verify It's Working
- Go to Settings → Discussion
- Find the Webmention section
- Test receiving using Webmentions.com or Telegraph
Send a test Webmention to one of your post URLs and it should appear in the comments.
Plugin Features
Webmention Plugin
What it does:
- Adds Webmention endpoint to your site
- Automatically discovers and verifies incoming mentions
- Sends Webmentions when you publish/update posts
- Stores mentions as WordPress comments
- Handles updates and deletions
Configuration:
Go to Settings → Discussion → Webmention Settings:
☑ Send Webmentions when publishing posts
☑ Send Webmentions for comments
☑ Send Webmentions for updates
☐ Require manual approval (optional)
Semantic Linkbacks Plugin
What it does:
- Parses microformats from source pages
- Displays rich mention information
- Detects interaction types (reply, like, repost)
- Shows author photos and names
- Formats content appropriately
Display examples:
Reply:
Sarah Johnson replied: "Great article! I especially liked the point about..."
Like:
❤️ Tom Chen liked this
Repost:
🔁 Alice Developer reposted this
Advanced Configuration
Custom Templates
Override mention display by creating templates in your theme:
Create: wp-content/themes/your-theme/semantic-linkbacks/
Add files:
comment-reply.php- For repliescomment-like.php- For likescomment-repost.php- For repostscomment.php- For generic mentions
Example (comment-reply.php):
<div class="comment-mention mention-reply">
<div class="mention-author">
<?php if ($author_avatar): ?>
<img src="<?php echo esc_url($author_avatar); ?>"
alt="<?php echo esc_attr($author_name); ?>"
class="avatar">
<?php endif; ?>
<strong><?php echo esc_html($author_name); ?></strong>
<span class="mention-type">replied:</span>
</div>
<div class="mention-content">
<?php echo wp_kses_post($comment_text); ?>
</div>
<div class="mention-meta">
<time datetime="<?php echo esc_attr($comment_date_iso); ?>">
<?php echo esc_html($comment_date); ?>
</time>
<a href="<?php echo esc_url($comment_source); ?>">View original</a>
</div>
</div>
Styling Mentions
Add CSS to distinguish mentions from comments:
/* In your theme's style.css */
.comment-mention {
border-left: 3px solid #4A90E2;
padding-left: 1rem;
margin: 1rem 0;
}
.mention-reply {
border-left-color: #4A90E2;
}
.mention-like {
border-left-color: #E94A4A;
}
.mention-repost {
border-left-color: #4AE290;
}
.mention-author {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.mention-author .avatar {
width: 32px;
height: 32px;
border-radius: 50%;
}
.mention-content {
margin-left: 2.5rem;
color: #333;
}
.mention-meta {
margin-left: 2.5rem;
font-size: 0.875rem;
color: #666;
margin-top: 0.5rem;
}
Filter Mentions in Admin
Add a filter to see only Webmentions in the comments admin:
The plugins automatically add a filter option in Comments:
- All
- Approved
- Pending
- Webmentions ← New filter
- Semantic Linkbacks ← Shows mentions with metadata
Separate Mentions from Comments
Display Webmentions separately from regular comments:
Add to comments.php in your theme:
<?php
// Get regular comments
$regular_comments = array_filter($comments, function($comment) {
return !get_comment_meta($comment->comment_ID, 'protocol', true);
});
// Get Webmentions
$webmentions = array_filter($comments, function($comment) {
return get_comment_meta($comment->comment_ID, 'protocol', true) === 'webmention';
});
?>
<!-- Display regular comments -->
<div class="comments-section">
<h3>Comments</h3>
<?php wp_list_comments(array(), $regular_comments); ?>
</div>
<!-- Display Webmentions -->
<div class="webmentions-section">
<h3>Mentions</h3>
<?php wp_list_comments(array(), $webmentions); ?>
</div>
Sending Webmentions
Automatic Sending
The Webmention plugin automatically sends mentions when you:
- Publish a new post
- Update an existing post
- Publish a comment (if enabled)
To configure: Settings → Discussion → Webmention Settings
Manual Sending
Use the Telegraph plugin for manual control:
- Install "Telegraph" plugin
- Go to Tools → Telegraph
- Enter your post URL
- See all outbound links
- Send Webmentions manually
Programmatic Sending
Send mentions via code:
// Send a Webmention
do_action('send_webmention', $source, $target);
// Send mentions for a specific post
function send_webmentions_for_post($post_id) {
$post = get_post($post_id);
$source = get_permalink($post_id);
// Extract links from content
preg_match_all('/<a[^>]+href=["\']([^"\']+)["\']/', $post->post_content, $matches);
foreach ($matches[1] as $target) {
if (filter_var($target, FILTER_VALIDATE_URL)) {
do_action('send_webmention', $source, $target);
}
}
}
IndieWeb Plugins Ecosystem
Core Plugins
IndieWeb Plugin Pack - Bundles everything:
- Webmention
- Semantic Linkbacks
- Micropub
- IndieAuth
- Syndication Links
- Post Kinds
Install for complete IndieWeb functionality.
Individual Plugins
Post Kinds:
- Add different post types (note, article, reply, like)
- Automatic microformats markup
- Rich post templates
IndieAuth:
- Login with your domain
- OAuth for Micropub
- Decentralized authentication
Syndication Links:
- Link to social media copies
- POSSE workflow support
- Backfeed integration
Bridgy Publish:
- Publish to social media
- Automatically send mentions
- Syndicate content
Troubleshooting WordPress
Mentions Not Appearing
Check Akismet:
Akismet might be marking Webmentions as spam:
- Go to Comments → Spam
- Look for Webmentions
- Mark as "Not Spam"
- Add to Settings → Akismet → Always Allow (if available)
Or disable Akismet for Webmentions:
// In functions.php
add_filter('pre_comment_approved', function($approved, $commentdata) {
if (isset($commentdata['comment_type']) &&
$commentdata['comment_type'] === 'webmention') {
// Skip Akismet for Webmentions
add_filter('akismet_comment_check', '__return_false');
}
return $approved;
}, 10, 2);
Endpoint Not Found
Check Permalinks:
- Go to Settings → Permalinks
- Click "Save Changes" (without changing anything)
- This flushes rewrite rules
- Test endpoint again
Verify manually:
curl -I https://yoursite.com/wp-json/webmention/1.0/endpoint
Should return 200 OK.
Not Sending Mentions
Check settings:
- Settings → Discussion
- Ensure "Send Webmentions" is checked
- Save changes
Test manually:
// In functions.php temporarily
add_action('init', function() {
if (isset($_GET['test_webmention'])) {
do_action('send_webmention',
'https://yoursite.com/test-post',
'https://target-site.com/their-post'
);
die('Webmention sent');
}
});
Visit: https://yoursite.com/?test_webmention
Slow Performance
Background Processing:
Install WP Background Processing plugin to queue Webmentions:
// Webmention plugin handles this automatically,
// but you can optimize further:
add_filter('webmention_process_async', '__return_true');
Limit Outbound Sending:
// Only send for new posts, not updates
add_filter('webmention_send_on_update', '__return_false');
Custom Implementations
Build Your Own Endpoint
If you want full control, register a custom endpoint:
// In functions.php or a plugin
add_action('rest_api_init', function() {
register_rest_route('custom/v1', '/webmention', array(
'methods' => 'POST',
'callback' => 'custom_webmention_handler',
'permission_callback' => '__return_true',
));
});
function custom_webmention_handler($request) {
$source = $request->get_param('source');
$target = $request->get_param('target');
// Validate
if (!filter_var($source, FILTER_VALIDATE_URL) ||
!filter_var($target, FILTER_VALIDATE_URL)) {
return new WP_Error('invalid_url', 'Invalid URLs', array('status' => 400));
}
// Queue for processing
wp_schedule_single_event(time(), 'process_custom_webmention', array(
'source' => $source,
'target' => $target,
));
return new WP_REST_Response('Accepted', 202);
}
// Process asynchronously
add_action('process_custom_webmention', function($source, $target) {
// Verify and store
custom_verify_and_store($source, $target);
}, 10, 2);
Best Practices for WordPress
- Use official plugins - Well-maintained and tested
- Enable caching - Webmentions work with caching plugins
- Moderate first mentions - Auto-approve subsequent ones
- Style appropriately - Make mentions visually distinct
- Test thoroughly - Use Webmentions.com and webmention.rocks
- Keep plugins updated - Get security fixes and features
Multisite Considerations
For WordPress Multisite:
- Install Webmention plugins network-wide
- Each site gets its own endpoint
- Configure per-site in individual dashboards
- Use Settings → Discussion on each subsite
Integration with Themes
Popular themes with Webmention support:
- IndieWeb themes - Built-in support
- Twenty Twenty-Four - Works well with plugins
- Autonomie - Designed for Webmentions
- SemPress - IndieWeb-friendly
Most themes work fine with the default plugin behavior.
Resources
WordPress makes Webmentions accessible to anyone, technical or not. With plugins handling the heavy lifting, you can focus on creating content and engaging with your community across the open web.
Related FAQs
How do I implement Webmentions on my site?
Step-by-step guide to adding Webmention support to your website, from beginner to advanced.
How do I add Webmentions to a static site?
Implementing Webmentions on static sites built with Jekyll, Hugo, Eleventy, Next.js, and other generators.
How do I handle spam Webmentions?
Strategies and techniques for preventing, detecting, and moderating spam Webmentions on your website.