0

I would like to disable every feed (comments, category, tags, author) as detailed here: https://wordpress.org/support/article/wordpress-feeds/ except for the "home-page feed" that you can found here:

http://example.com/feed/

It is important also removing links to the feeds in the head of the document.

I've found multiple articles on how to remove feeds globally (https://www.wpbeginner.com/wp-tutorials/how-to-disable-rss-feeds-in-wordpress/), but nothing on how to remove only selected ones without writing hundreds of lines of code.

1

1 Answer 1

1
// remove_author_feed_link( $link, $feed );
// As we do not pass $link and $feed is empty by default, function just exits
function remove_author_feed_link() {
    return;
}
add_filter( 'author_feed_link', 'remove_author_feed_link' );


function remove_category_feed_link() {
    return;
}
add_filter( 'category_feed_link', 'remove_category_feed_link');


function remove_search_feed_link() {
    return;
}
add_filter( 'search_feed_link', 'remove_search_feed_link' );


function remove_tag_feed_link() {
    return;
}
add_filter( 'tag_feed_link', 'remove_tag_feed_link' );


// Removes Post Comments Feed
function remove_comments_feed_link() {
    return;
}
add_filter( 'post_comments_feed_link', 'remove_comments_feed_link' );


// Removes global Comments Feed
add_filter( 'feed_links_show_comments_feed', '__return_false' );
2
  • your function leave intact the feed page for categories and so on...
    – Benjamin
    Commented Mar 26, 2019 at 15:01
  • example.com/category/feed is still working
    – Benjamin
    Commented Mar 26, 2019 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.