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.
4 Answers
function remove_comment_feeds( $for_comments ){
if( $for_comments ){
remove_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
remove_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
}
}
add_action( 'do_feed_rss2', 'remove_comment_feeds', 9, 1 );
add_action( 'do_feed_atom', 'remove_comment_feeds', 9, 1 );