Categories
WordPress

Disable RSS Feed Pages in WordPress

To disable RSS feed pages in WordPress, hook into the action filters provided for each feed page function and then redirect to the home page.

// Disable RSS feed pages
add_action( 'do_feed', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_rdf', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_rss', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_rss2', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_atom', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_rss2_comments', 'disable_rss_feed_pages', 1);
add_action( 'do_feed_atom_comments', 'disable_rss_feed_pages', 1);

function disable_rss_feed_pages() {
    wp_redirect( site_url() );
    exit();
}

By Abhineet Mittal

Abhineet is IIM Alumnus and Founder of popular Digital Publishing Platform, Sahityapedia. He is a technology enthusiast by hobby & an avid reader.

Leave a Reply

Your email address will not be published.