可以通过feed(RSS、Atom、RDF)使用以下功能使站点完全不可访问:
function itsme_disable_feed() {
wp_die( __( \'No feed available, please visit the <a href="\'. esc_url( home_url( \'/\' ) ) .\'">homepage</a>!\' ) );
}
add_action(\'do_feed\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_rdf\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_rss\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_rss2\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_atom\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_rss2_comments\', \'itsme_disable_feed\', 1);
add_action(\'do_feed_atom_comments\', \'itsme_disable_feed\', 1);
但这会禁用整个站点的提要,即主提要、类别提要、标签提要、评论提要、帖子提要、页面提要、自定义帖子类型提要等。如何仅禁用main feed 以及main comments feed 网站的?i、 e.仅制造site.com/feed/
和site.com/comments/feed/
无法接近
简单地使用下面的内容隐藏提要是不可取的:
remove_action( \'wp_head\', \'feed_links_extra\', 3 );
remove_action( \'wp_head\', \'feed_links\', 2 );