Steps
-
Upload your logo to the WordPress Media Library.
-
Copy its image URL.
-
Replace
/wp-content/uploads/site-logo.pngin the code with your logo’s actual URL. -
Add the snippet to your child theme’s
functions.phpfile or a PHP snippets plugin. -
Visit
yourdomain.com/wp-login.phpto check the result.
Hook Used
-
login_enqueue_scripts— Adds custom CSS to the login page. -
login_headerurl— Changes the logo link destination. -
login_headertext— Sets the logo’s accessible title text.
Type: WordPress Login Page Customization
Output: Your WordPress login page displays your custom logo instead of the default WordPress logo, and clicking it opens your website’s homepage.
Customization: Adjust height: 90px; to change the logo area’s height.
function custom_wordpress_login_logo() {
?>
<style>
body.login h1 a {
background-image: url('<?php echo esc_url( home_url( '/wp-content/uploads/site-logo.png' ) ); ?>');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 100%;
height: 90px;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'custom_wordpress_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' );
Tested on
Reported by the author on October 17, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.4. It may still work.
