如何关闭wordpress feed

将以下代码复制到wordpress主题的functions.php中

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);