Keep Feeds Out of Search Results
Sends an X-Robots-Tag header that asks search engines not to index your RSS feeds, so feed URLs do not compete with your real pages.
Opens WPIDE on
Code
add_action( 'template_redirect', function () {
if ( is_feed() && ! headers_sent() ) {
header( 'X-Robots-Tag: noindex, follow', true );
}
}, 1 );
Notes
Feed readers ignore this header, so subscribers are not affected.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.