How to apply custom styling to WordPress error pages (like 404 or PHP errors)?

Solution:

If you want to customize the login or error page CSS, you can add the following code to your activated theme’s functions.php file:


function my_login_custom_css() { 
    <?php
    ?>
    <style type="text/css">
        body#error-page {
            background-color: #9100c0;
        }
    </style>
    <?php
}
add_action('login_enqueue_scripts', 'my_login_custom_css'); // Optional: hook for login page

This will apply a custom background color (#9100c0) to the error page.