Custom Login Page Styling

February 8, 2026

The default WordPress login page shows the WordPress logo and generic styling. This snippet lets you brand it with your own logo, colors, and styles for a professional appearance.

Add to your functions.php

// Custom login page styles
function custom_login_styles() {
    $logo_url = get_template_directory_uri() . '/images/logo.png';
    ?>
    <style>
        body.login {
            background-color: #f5f5f5;
        }
        #login h1 a {
            background-image: url('<?php echo esc_url($logo_url); ?>');
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            width: 100%;
            height: 80px;
        }
        .login form {
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        .login #backtoblog a,
        .login #nav a {
            color: #333;
        }
        .login #backtoblog a:hover,
        .login #nav a:hover {
            color: #0073aa;
        }
        .wp-core-ui .button-primary {
            background-color: #0073aa;
            border-color: #006799;
            border-radius: 4px;
        }
        .wp-core-ui .button-primary:hover {
            background-color: #006799;
        }
    </style>
    <?php
}
add_action('login_enqueue_scripts', 'custom_login_styles');

// Change login logo URL to homepage
function custom_login_logo_url() {
    return home_url('/');
}
add_filter('login_headerurl', 'custom_login_logo_url');

// Change login logo hover title
function custom_login_logo_title() {
    return get_bloginfo('name');
}
add_filter('login_headertext', 'custom_login_logo_title');

What this does

  • login_enqueue_scripts – Injects custom CSS into the login page
  • login_headerurl – Changes the logo link from wordpress.org to your homepage
  • login_headertext – Changes the logo hover text to your site name

Note: Replace /images/logo.png with the actual path to your logo file in your theme directory.

Check your WordPress site now

InspectWP analyzes your WordPress site for security issues, SEO problems, GDPR compliance, and performance — for free.

Analyze your site free