38

How to Change the WordPress Login Logo Image

Powered by WPCodeBox

This is how you change the WordPress admin logo to your own custom logo.


function custom_login_logo() {
	$logo_url = esc_url( wp_upload_dir()['baseurl'] . '/my-logo.svg');
	$css = "#login h1 a {
        background: url('{$logo_url}') no-repeat center / contain;
        width:auto;
        max-width: 320px;
        height: 80px;
    }";

	wp_add_inline_style( 'login', $css );
}

add_action( 'login_enqueue_scripts', 'custom_login_logo');
We also have a video in which we use this snippet:

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.