Home > Dev > WordPress Customization > Changing the Login Page Logo

Changing the Login Page Logo

This code will change the logo on the WordPress login page.

// Add this to your theme's functions.php file

function custom_login_logo() {
    echo '
    <style type="text/css">
        #login h1 a {
            background-image: url(' . get_stylesheet_directory_uri() . '/images/custom-logo.png);
            background-size: contain;
            width: 100%;
            height: 80px;
        }
    </style>';
}
add_action('login_enqueue_scripts', 'custom_login_logo');

function custom_login_logo_url() {
    return home_url();
}
add_filter('login_headerurl', 'custom_login_logo_url');

function custom_login_logo_url_title() {
    return 'Your Site Name';
}
add_filter('login_headertext', 'custom_login_logo_url_title');
Back