Open your site’s source code (Ctrl+U). Look at the <head> section.
See dozens of lines you don’t understand?
Most of them are useless in 2026.
The problem: WordPress head bloat
WordPress adds many elements to the <head> section by default. While some are useful, many are legacy code from 2010 that nobody uses anymore. This bloat:
- Slows down your site (extra HTTP requests)
- Wastes bandwidth (unnecessary scripts/styles)
- Reveals information (WordPress version, server info)
- Hurts SEO (cluttered HTML, slower page speed)
What’s in a typical WordPress head?
- RSS feed links (posts, comments, categories)
- Windows Live Writer manifest
- Really Simple Discovery (RSD)
- WordPress generator meta tag
- Emoji detection scripts
- Shortlink tags
- Adjacent post links
- And more…
Why clean up the head?
Performance benefits
Before cleanup:
- 15+ extra
<link>and<script>tags - ~50KB of unnecessary JavaScript/CSS
- Multiple DNS lookups for external resources
- Slower First Contentful Paint (FCP)
After cleanup:
- Clean, minimal
<head>section - Faster page load times
- Better Core Web Vitals scores
- Improved SEO rankings
Security benefits
Removing the WordPress generator tag prevents attackers from:
- Identifying your WordPress version
- Targeting known vulnerabilities
- Profiling your site for attacks
Professional appearance
A clean <head> section:
- Looks more professional to developers
- Easier to debug and maintain
- Better for code audits
- Shows attention to detail
Complete head cleanup guide
1. Comment RSS feeds
WordPress generates a separate RSS feed for every post, category, tag, and… comments. Unless you run a news site where people subscribe to comment threads via RSS (who does that?), this is just wasting server resources.
// Remove comment feed links
add_filter( 'feed_links_show_comments_feed', '__return_false' );
// Remove all extra RSS feed links
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
What this removes:
<link rel="alternate" type="application/rss+xml" title="Comments Feed">- Comment-specific RSS feeds
2. Windows live writer (wlwmanifest)
When was the last time you used Windows Live Writer? 2010? WordPress still adds this header by default.
// Remove Windows Live Writer manifest
remove_action( 'wp_head', 'wlwmanifest_link' );
// Remove Really Simple Discovery (RSD)
remove_action( 'wp_head', 'rsd_link' );
What this removes:
<link rel="wlwmanifest" type="application/wlwmanifest+xml"><link rel="EditURI" type="application/rsd+xml">
Why remove:
- Windows Live Writer was discontinued in 2017
- RSD is rarely used by modern clients
- Saves HTTP requests
3. WordPress generator meta tag
Reveals your WordPress version to everyone (security risk).
// Remove WordPress version from head
remove_action( 'wp_head', 'wp_generator' );
// Also remove from RSS feeds
add_filter( 'the_generator', '__return_empty_string' );
What this removes:
<meta name="generator" content="WordPress 6.4.2">
Security benefit:
- Attackers can’t identify your WordPress version
- Prevents targeting known vulnerabilities
4. Wp emoji scripts
WordPress loads a JS script and CSS styles to convert :) characters into images. Modern browsers handle emojis natively. This script is just extra HTTP requests (bloat).
// Remove emoji detection script
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
// Remove emoji styles
remove_action( 'wp_print_styles', 'print_emoji_styles' );
// Remove emoji from admin
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
// Remove emoji from emails
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
// Remove emoji DNS prefetch
remove_filter( 'wp_resource_hints', 'wp_dependencies_emoji_styles', 10, 2 );
What this removes:
wp-emoji-release.min.js(~15KB)wp-emoji-styles.css(~5KB)- Emoji DNS prefetch to s.w.org
Performance benefit:
- Saves ~20KB per page load
- Removes 2 HTTP requests
- Faster page rendering
5. Shortlinks
WordPress generates shortlink tags for every post/page.
// Remove shortlink from head
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
// Remove shortlink from header
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
// Remove shortlink from HTTP headers
remove_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
What this removes:
<link rel="shortlink" href="https://yoursite.com/?p=123">
Why remove:
- Rarely used feature
- Adds unnecessary HTML
6. Adjacent post links
WordPress adds links to previous/next posts in the head.
// Remove adjacent post links
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
// Remove start post link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
// Remove index link
remove_action( 'wp_head', 'index_rel_link', 10, 0 );
// Remove parent post link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
What this removes:
<link rel="prev" href="..."><link rel="next" href="..."><link rel="start" href="..."><link rel="index" href="...">
Why remove:
- Modern browsers don’t use these
- Adds clutter to HTML
- Minimal SEO benefit
7. REST API links
WordPress adds REST API discovery links.
// Remove REST API links from head
remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10, 1 );
// Remove REST API from HTTP headers
remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
What this removes:
<link rel="https://api.w.org/" href="..."><link rel="alternate" type="application/json+oembed">
Note: Only remove if you’re not using REST API or oEmbed.
8. DNS prefetch
WordPress prefetches DNS for external resources.
// Remove DNS prefetch
remove_action( 'wp_head', 'wp_resource_hints', 2 );
// Or selectively remove specific prefetches
add_filter( 'wp_resource_hints', function( $urls, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
// Remove specific domains
$urls = array_filter( $urls, function( $url ) {
return strpos( $url, 'fonts.googleapis.com' ) === false;
} );
}
return $urls;
}, 10, 2 );
What this removes:
<link rel="dns-prefetch" href="//fonts.googleapis.com">- Other DNS prefetch links
Why consider removing:
- Modern browsers handle prefetching automatically
- Can cause privacy concerns (prefetching external domains)
The complete “clean head” snippet
Put this comprehensive cleanup function in your functions.php:
/**
* Clean up WordPress head section
* Removes unnecessary links, scripts, and meta tags
*/
function wppoland_cleanup_head() {
// Remove RSS feed links
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
add_filter( 'feed_links_show_comments_feed', '__return_false' );
// Remove Windows Live Writer and RSD
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'rsd_link' );
// Remove WordPress generator
remove_action( 'wp_head', 'wp_generator' );
add_filter( 'the_generator', '__return_empty_string' );
// Remove emoji scripts and styles
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'wp_resource_hints', 'wp_dependencies_emoji_styles', 10, 2 );
// Remove shortlinks
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
// Remove adjacent post links
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'index_rel_link', 10, 0 );
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
// Remove REST API links (optional - only if not using REST API)
// remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
// remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10, 1 );
// remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
// Remove DNS prefetch (optional)
// remove_action( 'wp_head', 'wp_resource_hints', 2 );
}
add_action( 'init', 'wppoland_cleanup_head' );
Advanced: Conditional cleanup
Only remove certain elements in specific contexts:
function wppoland_conditional_head_cleanup() {
// Only remove emoji on frontend, keep in admin
if ( ! is_admin() ) {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
}
// Keep REST API links if using headless WordPress
if ( ! defined( 'WP_HEADLESS' ) || ! WP_HEADLESS ) {
remove_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
}
}
add_action( 'init', 'wppoland_conditional_head_cleanup' );
Testing your cleanup
Before/After comparison
Before cleanup:
<head>
<link rel="alternate" type="application/rss+xml" title="Site Feed">
<link rel="alternate" type="application/rss+xml" title="Comments Feed">
<link rel="wlwmanifest" type="application/wlwmanifest+xml">
<link rel="EditURI" type="application/rsd+xml">
<meta name="generator" content="WordPress 6.4.2">
<link rel="shortlink" href="https://site.com/?p=123">
<link rel="prev" href="...">
<link rel="next" href="...">
<script src="wp-emoji-release.min.js"></script>
<style>/* emoji styles */</style>
<!-- ... many more lines ... -->
</head>
After cleanup:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page Title</title>
<!-- Clean and minimal -->
</head>
Tools to verify
- View Page Source (
Ctrl+U): Check<head>section - Chrome DevTools: Network tab shows HTTP requests
- PageSpeed Insights: See reduction in HTML size
- GTmetrix: Compare before/after page weight
Performance impact
Typical improvements:
- HTML size: -2KB to -5KB per page
- HTTP requests: -3 to -8 requests per page
- JavaScript: -15KB (emoji script)
- CSS: -5KB (emoji styles)
- Page load time: -50ms to -200ms
Real-world example:
- Before: 45KB HTML, 12 HTTP requests in
<head> - After: 40KB HTML, 4 HTTP requests in
<head> - Improvement: 11% smaller HTML, 67% fewer requests
Security considerations
WordPress version hiding
Removing the generator tag is good, but:
- Plugins still reveal version: Check plugin headers
- Readme.html: Delete
/wp-content/readme.html - Login page: Version shown in source (harder to hide)
- REST API: May reveal version in responses
Complete version hiding:
// Remove from head (already done above)
remove_action( 'wp_head', 'wp_generator' );
// Remove from RSS
add_filter( 'the_generator', '__return_empty_string' );
// Remove from login page (advanced)
add_filter( 'login_headertext', function() {
return get_bloginfo( 'name' );
} );
Best practices
1. Test before deploying
Always test cleanup on a staging site first. Some plugins/themes may depend on removed elements.
2. Keep what you need
Don’t remove REST API links if you’re using headless WordPress. Don’t remove RSS feeds if you have active subscribers.
3. Document your changes
Add comments explaining why you’re removing each element:
// Remove emoji scripts - modern browsers handle emojis natively
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
4. Use a plugin for non-Developers
For clients who aren’t developers, use a plugin like “Remove Header Junk” or “Clean Head” instead of code.
Troubleshooting
Problem: Site breaks after cleanup
Solution: Some plugins may depend on removed elements. Test in staging first, remove one element at a time to identify the culprit.
Problem: REST API not working
Solution: Don’t remove REST API links if you’re using:
- Headless WordPress
- Gutenberg editor (uses REST API)
- Mobile apps
- Third-party integrations
Problem: RSS feeds not working
Solution: If you have active RSS subscribers, keep feed links:
// Keep main feed, remove only comment feeds
// Don't remove feed_links, only feed_links_extra
Summary
Cleaning up the WordPress <head> section is essential for:
- ✅ Performance: Faster page loads, fewer HTTP requests
- ✅ Security: Hide WordPress version, reduce attack surface
- ✅ SEO: Cleaner HTML, better Core Web Vitals
- ✅ Professionalism: Clean, maintainable code
Key Takeaways:
- Remove emoji scripts (modern browsers handle natively)
- Remove WordPress generator (security)
- Remove legacy links (Windows Live Writer, RSD)
- Remove unnecessary RSS feeds (unless needed)
- Test thoroughly before deploying
- Keep what you actually use (REST API, main RSS feed)
In 2026, a clean <head> section is not optional – it’s a requirement for professional WordPress sites. Your site will be faster, more secure, and easier to maintain.



