Skip to content

Instantly share code, notes, and snippets.

@guydumais
Created July 3, 2017 07:59
Show Gist options
  • Save guydumais/7352eaf5ae668143c4a87e3070ca896f to your computer and use it in GitHub Desktop.
Save guydumais/7352eaf5ae668143c4a87e3070ca896f to your computer and use it in GitHub Desktop.
WordPress / Disable RSS Feeds
<?php
/**
* Disable all RSS Feeds actions and filters in WordPress.
*
* @author Guy Dumais.
* @link https://en.guydumais.digital/how-to-disable-rss-feeds-in-wordpress/
*/
add_action( 'init', $af = function() {
// Disable all RSS Feeds actions.
remove_action( 'do_feed_rdf', 'do_feed_rdf', 10 );
remove_action( 'do_feed_rss', 'do_feed_rss', 10 );
remove_action( 'do_feed_rss2', 'do_feed_rss2', 10 );
remove_action( 'do_feed_atom', 'do_feed_atom', 10 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
// Disable all RSS Feeds filters.
remove_filter( 'the_content_feed', '_oembed_filter_feed_content' );
} );
unset( $af );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment