今天来给大家说说,WordPress网站如何防止采集软件采集,不过想完完全全防止是防不住的,不过简单阻止一下还是可以的,在主题目录中,找到“functions.php”,下载到本地,利用编辑器打开,切勿使用文本编辑器打开,插件以下代码,保存上传即可。后面如果发现其他更好的方法,也会放出。

//禁用 feed
function disable_our_feeds() {
wp_die( __('Error: No RSS Feed Available, Please visit our homepage.'));
}
add_action('do_feed', 'disable_our_feeds', 1);
add_action('do_feed_rdf', 'disable_our_feeds', 1);
add_action('do_feed_rss', 'disable_our_feeds', 1);
add_action('do_feed_rss2', 'disable_our_feeds', 1);
add_action('do_feed_atom', 'disable_our_feeds', 1);


// 防采集cdn.qicaiyun.top
if(!$_SERVER['HTTP_USER_AGENT']) { //判断是否为空AGENT
header("Content-type: text/html; charset=utf-8");
echo '禁止使用采集软件采集';
exit;
}