我们可以开放 feed 地址来让别人订阅自己的博客更新,默认的 feed 地址一般是 域名+ atom.xml 或者 /rss , /feed 等等。但是这样会导致很多垃圾 bot 来采集站点,所以我们通常会选择修改默认的 feed 地址,只开放给我们想开放的人用。
以下记录了博主修改默认 feed 地址的过程。
主要有用到两个插件:
一个是 Remove RSS Feed ,另一个是 Custom Simple Rss ,这两个插件基本装上启用就搞定了。
下面来讲一讲这两个插件:
Remove RSS Feed
这个插件主要是用来关闭 wp 默认的feed ,启用之后访问 /feed 提示:

其实现原理也很简单,就是重写 feed 函数,不使用这个插件的话,也可以在主题的 functions.php
添加以下代码:
function wp_remove_rss_feed()
{
wp_die( __('No feed available, Please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}
add_action('do_feed', 'wp_remove_rss_feed', 1);
add_action('do_feed_rdf', 'wp_remove_rss_feed', 1);
add_action('do_feed_rss', 'wp_remove_rss_feed', 1);
add_action('do_feed_rss2', 'wp_remove_rss_feed', 1);
add_action('do_feed_atom', 'wp_remove_rss_feed', 1);
add_action('do_feed_rss2_comments', 'wp_remove_rss_feed', 1);
add_action('do_feed_atom_comments', 'wp_remove_rss_feed', 1);
Custom Simple Rss
这个插件在设置里可以修改各种feed 地址,一般采用默认就够了。在 Tutorial and Examples 中可以看到默认的生成的feed 地址。

Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!