add_action('template_redirect', function (string $template): string {
global $wp_query;
if (!$wp_query->is_author()) {
return $template;
}
$wp_query->set_404();
status_header(404);
});
curl -I https://site.test/author/admin
HTTP/2 404