Feed订阅曾一度非常流行,很多大小中型网站博客会在网站显眼位置添加一个订阅图标以及被订阅数量,不过现在基本没有多少用户使用,第三方阅读器网站基本也关闭了服务,继续保留Feed已经没有多大价值,反而会被人利用于采集内容,造成服务器资源消耗,因此博客吧已经关闭了Feed。

wordpress屏蔽Feed代码:

把下面的代码添加到主题的functions.php文件

1
2
3
4
5
6
7
8
function disable_feed() {
	wp_die(__(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'<h2>博客吧已关闭Feed订阅,请访问<a href=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.get_bloginfo(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'url\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\').\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">博客吧首页</a>!</h2>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'));
}
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'do_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'disable_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', 1);
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'do_feed_rdf\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'disable_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', 1);
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'do_feed_rss\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'disable_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', 1);
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'do_feed_rss2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'disable_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', 1);
add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'do_feed_atom\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'disable_feed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\', 1);

保存文件即可。测试是否成功,可以在浏览器地址输入http://域名/feed 查看

相关新闻

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

151-1101-0018

在线咨询:
邮件:30115776@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部