snippet 1 min read PHP 7.4+ WP 5.0+
Replace the WordPress Logo on the Login Page
Use the logo from WordPress Customizer settings on the login screen, with a fallback to the default WordPress logo.
Updated Dec 1, 2025 #wordpress #php #branding #login #snippet
Replacing the default login logo is a small branding improvement for client, team, and contributor sites. This version reads the logo configured under Appearance → Customize → Site Identity and falls back to the classic WordPress logo when no custom logo is set.
The snippet
function custom_login_logo() { $custom_logo_id = get_theme_mod( 'custom_logo' ); $logo_url = $custom_logo_id ? wp_get_attachment_image_url( $custom_logo_id, 'full' ) : 'https://s.w.org/style/images/wp-header-logo.png'; ?> <style type="text/css"> #login h1 a, .login h1 a { background-image: url('<?php echo esc_url( $logo_url ); ?>'); height: 80px; width: 100%; background-size: contain; background-repeat: no-repeat; padding-bottom: 20px; }
body.login { background-color: #3c434a; }
body.login #backtoblog a, body.login #nav a { color: #fff; }
body.login input#wp-submit { background: #3c434a; border: #3c434a; padding: 0 30px; }
body.login input#user_login, body.login input#user_pass { border-radius: 25px; padding: 0 15px; } </style> <?php}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_title() { return get_bloginfo( 'name' );}add_filter( 'login_headertext', 'custom_login_logo_title' );Set the logo in the Customizer, then visit /wp-login.php to see the result. The logo links back to the homepage and uses the site name as its hover text.