jump to navigation

How to Disable WordPress Feeds July 30, 2011

Posted by Tournas Dimitrios in Wordpress - 3.

Nowadays , most Internet users are familiar with RSS-feeds and use them . For a good introduction to RSS read this article ” RSS feeds for the absolute beginner ” . By default, WordPress include the popular RSS functionality , which is great for blogs . Try it! You can add /feed/ to the end of most URLs on your blog and get a RSS version of that content . For example :

  • Add  /feed/ to your main blog’s URL , you’ll get the last 10 or so of your posts .
  • Add /feed/ to a post permalink URL , you’ll geet a RSS feed of the comments on that post .
  • Add /feed/ to the end of a tag URL on your blog  , it’ll show you a feed of posts with that tag
  • If you go to your main site feed , and then add ?s=some-string to the end of the URL , it’ll show you a feed of just the posts that contain the word “some-string” in them . ( This is called a search feed )

The above functionality  (and more) work for any WordPress blog , so you have quite a bit of flexibility in dealing with feeds . But if you’re using your WordPress install as a static site , having RSS feeds may become an unnecessary functionality for your visitors . A good practice is to disable this functionality .

This code will totally disable RSS feeds (As well as other formats) from your blog . Just paste the code into functions.php , and you’re done .

 * disable feed
function fb_disable_feed() {
  wp_die( __('No feed available,please visit our <a href="https://tournasdimitrios1.wordpress.com/wp-admin/'.%20get_bloginfo('%3Cspan%20class=">url') .'">homepage</a>!') );
add_action('do_feed', 'fb_disable_feed', 1);
add_action('do_feed_rdf', 'fb_disable_feed', 1);
add_action('do_feed_rss', 'fb_disable_feed', 1);
add_action('do_feed_rss2', 'fb_disable_feed', 1);
add_action('do_feed_atom', 'fb_disable_feed', 1);

Source : >>>



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s