I’d like to customize my WordPress blog in such a way that it is no more possible to access the comments feed.
Other feeds should still be available, and it should still be possible to add comments to any article.
I tried to find a plugin to do this, but what I found is a all or nothing feature, without the possibility to finely adjust which feeds are allowed and which are not.
As mentioned by @glueckpress, Since 4.4 you can use the
feed_links_show_comments_feed
filter.Example (in your theme functions.php file) :
@Shazzadâs approach seems to not work when
current_theme_supports( 'automatic-feed-links' )
, because up to 4.3 WordPress seems to be pretty ego about feed links. You would have toremove_action( 'wp_head', 'feed_links', 2 )
hard and add your own function printing only the link for post feeds.However, from 4.4 this seems to get easier with a brand-new filter:
feed_links_show_posts_feed
.I wanted to remove the comments feed and posts comments feed. As of WordPress 5.4.2, this worked for me.
Add this into your “after_setup_theme” action.
Add this right after that line:
After your “after_setup_theme action, add this function and filter ( I pulled this function from https://jeffvautin.com/2016/03/removing-comments-rss-feeds-from-wordpress/ blog.) It will removed the posts comments feed.
I also add this to remove those non-essential feeds
I believe this will just give me the main feed. I’m not sure if this is the best way of going about this, but seems to do the trick.