remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
add_action( 'do_feed', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_rdf', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_rss', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_rss2', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_atom', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_rss2_comments', 'zl_remove_feed_and_redirect', 1 );
add_action( 'do_feed_atom_comments', 'zl_remove_feed_and_redirect', 1 );
function zl_remove_feed_and_redirect() {
wp_redirect( esc_url( home_url( '404' ) ), 301 );
die();
}
But I think the redirect should be on through Nginx, before a client-server. Actually, it is a correct solution
Top comments (0)