Why I do not need RSS Feed on my WordPress blog, How to disable it

One of the problems I found is the number of links with feeds in my blog that are crawled, not indexed by Google.

Frankly I don’t know how many subscribed to my blog feed. And it feels less effective using RSS feed. For that I decided that I do not need RSS Feed on my WordPress blog, practically disable the RSS feed.

Remember, WordPress doesn’t have an option in its Dasboaard to disable feeds, because RSS Feeds Allow Users to subscribe blog posts in your website.

After a long time not blogging, I returned blogging and I started repairing the problematic links.
I use Google Search Console to hunt and ask indexing again after repairs

I have a plugin, Redirection already installed on my website, so I only need a PHP function that disables RSS and tells all that the feed is no longer available, ask them to open the blog’s homepage instead.
I use the URL Inspection tool in Google Search Console to recognize which Feed links need to be redirected with Redirection to the Post links

Simply Add this PHP function code to your theme’s functions.php file

function pxrt_disable_feed() {
global $wp_query;
$wp_query->is_feed = false;
status_header( 404 );
wp_die( __('Sorry. No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!'),'',404);
add_action('do_feed', 'pxrt_disable_feed', 1);
add_action('do_feed_rdf', 'pxrt_disable_feed', 1);
add_action('do_feed_rss', 'pxrt_disable_feed', 1);
add_action('do_feed_rss2', 'pxrt_disable_feed', 1);
add_action('do_feed_atom', 'pxrt_disable_feed', 1);
add_action('do_feed_rss2_comments', 'pxrt_disable_feed', 1);
add_action('do_feed_atom_comments', 'pxrt_disable_feed', 1);
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action('wp_head', 'rsd_link');

When Someone Tries To Go To The RSS Feed Link (yoursite.com/feed/) They Will Receive A Message That No Feed is Available.

Please remember to remove the links to RSS feeds within the WordPress theme or corresponding sidebar and footer widgets after.

Last step, block feeds in robots.txt. This will make the search engins robots crawling on-site content, preventing them crawling the feeds.


Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: