Thanks Venutius, I spent some time using your code along with ChatGPT and this seems to have worked for me, all the feeds are gone….maybe this will help someone else!
function disable_all_rss_feeds() {
// Disable all WordPress feeds
function disable_all_feeds() {
wp_die(__('No feed available, please visit the <a href="'. get_bloginfo('url') .'">homepage</a>!'));
}
add_action('do_feed', 'disable_all_feeds', 1);
add_action('do_feed_rdf', 'disable_all_feeds', 1);
add_action('do_feed_rss', 'disable_all_feeds', 1);
add_action('do_feed_rss2', 'disable_all_feeds', 1);
add_action('do_feed_atom', 'disable_all_feeds', 1);
add_action('do_feed_rss2_comments', 'disable_all_feeds', 1);
add_action('do_feed_atom_comments', 'disable_all_feeds', 1);
// Remove RSS feed links from the header
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);
// Disable BuddyPress feeds
remove_action('bp_activity_feed', 'bp_activity_action_sitewide_feed');
remove_action('bp_activity_sitewide_feed', 'bp_activity_action_sitewide_feed');
remove_action('bp_member_activity_feed', 'bp_activity_action_sitewide_feed');
remove_action('bp_group_activity_feed', 'bp_activity_action_sitewide_feed');
remove_action('bp_member_feed', 'bp_dtheme_activity_feed');
remove_action('bp_group_feed', 'bp_dtheme_group_activity_feed');
// BuddyPress Nouveau template pack feed removals
remove_action('bp_nouveau_group_header_meta', 'bp_nouveau_group_meta', 50);
remove_action('bp_nouveau_group_header_meta', 'bp_nouveau_group_meta', 50);
remove_action('bp_nouveau_action_activity_content', 'bp_nouveau_activity_feed', 5);
// Disable BuddyPress members feeds
remove_action('bp_members_directory_members_feed', 'bp_members_feed');
// Disable BuddyPress groups feeds
remove_action('bp_groups_directory_groups_feed', 'bp_groups_feed');
remove_action('bp_group_activity_feed', 'bp_group_activity_custom_feed');
// Disable BuddyPress blogs feeds
remove_action('bp_blogs_directory_blogs_feed', 'bp_blogs_feed');
remove_action('bp_blog_comments_feed', 'bp_blog_comments_custom_feed');
// Disable BuddyPress forums feeds
remove_action('bp_forums_directory_topics_feed', 'bp_forums_feed');
remove_action('bp_forums_topic_feed', 'bp_forum_topic_custom_feed');
}
add_action('bp_init', 'disable_all_rss_feeds', 1);
// Disable BuddyPress Nouveau feeds
function disable_buddypress_nouveau_feeds() {
remove_action('bp_nouveau_activity_feed', 'bp_nouveau_activity_feed');
remove_action('bp_nouveau_group_feed', 'bp_nouveau_group_feed');
}
add_action('bp_init', 'disable_buddypress_nouveau_feeds', 1);
// Disable pingbacks and trackbacks for privacy
add_filter('xmlrpc_methods', function($methods) {
unset($methods['pingback.ping']);
return $methods;
});
add_filter('wp_headers', function($headers) {
unset($headers['X-Pingback']);
return $headers;
});
add_filter('pings_open', '__return_false', 10, 2);
// Remove RSS feed div by ID and class using jQuery
function remove_rss_feed_div() {
if (is_buddypress()) {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#activity-rss-feed.feed').remove();
});
</script>
<?php
}
}
add_action('wp_footer', 'remove_rss_feed_div');
add_filter( 'bp_rest_api_is_available', '__return_false' );