add_action('template_redirect', function() { if (is_404()) { wp_redirect(home_url(), 301); // Redireciona para a homepage com status 301 exit; } });