views:

34

answers:

1

i'm in need a solution via coding. on how to completely hide my blog feed. I know how to optimize related hook and filter such as 'the_excerpt_rss' and 'the_post_rss'. And also understand how to limit access or make my blog private.

so, the question is more about howto blocking feed access without make my blog private ?

i hope the solution will be not some apache .htacceess. Cause i need to code it directly into my theme..

sorry if this's too much to asked.

+3  A: 

This should do it in functions.php without having to edit core WP files:

function fb_disable_feed() {
    wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('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);

Also remove the feed link in your header.php

songdogtech
i also found the similar solution and it's seem working fine. But thanks to mention it. ;D
justjoe