-1

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
// 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' );
  • your function leave intact the feed page for categories and so on... – Benjamin Mar 26 '19 at 15:01
  • example.com/category/feed is still working – Benjamin Mar 26 '19 at 15:01
  • Do you see dependence between function names and what they do? Can you invent what to google for? Or you want a ready-made piece of code with no effort from your side? – Max Yudin Mar 26 '19 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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