The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Add a Custom Login Page Logo in WordPress

Shared by Amit Dholiya · October 17, 2026 · @login_enqueue_scripts,login_headerurl,login_headertext

17 views
Back to Snippets

Steps

  1. Upload your logo to the WordPress Media Library.

  2. Copy its image URL.

  3. Replace /wp-content/uploads/site-logo.png in the code with your logo’s actual URL.

  4. Add the snippet to your child theme’s functions.php file or a PHP snippets plugin.

  5. Visit yourdomain.com/wp-login.php to check the result.

Hook Used

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

WordPress 6.8

Reported by the author on October 17, 2026. WPFolks has not verified this.

Not tested against WordPress 7.1.4. It may still work.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by