How to Change the Login Logo in WordPress the Easy Way without a Plugin

How to Change the Login Logo in WordPress the Easy Way without a Plugin

Last Updated on November 11, 2023 by Mike Kipruto

To change the login logo in your WordPress Login Screen without using a plugin, you can add the following code to your theme’s functions.php file or in a custom plugin:

/**
 * How to Change the Login Logo in WordPress the Easy Way without a Plugin
 * @link https://kipmyk.co.ke/code/how-to-change-the-login-logo-in-wordpress-the-easy-way-without-a-plugin/
 */
add_action('login_head', 'mk_custom_login_logo');
function mk_custom_login_logo() {
    // Replace 'your-logo-url.png' with the URL of your custom login logo image.
    $logo_url = 'your-logo-url.png';

    // Get the width and height of the logo image.
    list($width, $height) = getimagesize($logo_url);

    // Output the custom login logo.
    echo '<style type="text/css">
        .login h1 a {
            background-image: url(' . esc_url($logo_url) . ');
            background-size: contain;
            width: ' . esc_attr($width) . 'px;
            height: ' . esc_attr($height) . 'px;
        }
    </style>';
}

Note: Please replace 'your-logo-url.png' with the URL of your custom login logo image and ensure to upload the logo image to your WordPress media library or any publicly accessible location on your server.