# Use Your Logo on the Login Page

> Replaces the WordPress logo on the login screen with your theme logo, your Site Icon, or an image URL you provide.

- Type: PHP
- Runs: Run everywhere
- Category: [Login](https://wpide.com/library/category/login/)
- Tags: login, logo, branding
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/login-page-logo/

## Code

```php
add_action( 'login_enqueue_scripts', function () {
    $logo_url = ''; // Optional: paste a full image URL here.

    if ( '' === $logo_url ) {
        $logo_id = (int) get_theme_mod( 'custom_logo' );
        $logo_url = $logo_id ? (string) wp_get_attachment_image_url( $logo_id, 'medium' ) : '';
    }

    if ( '' === $logo_url && has_site_icon() ) {
        $logo_url = get_site_icon_url( 192 );
    }

    if ( '' === $logo_url ) {
        return;
    }

    printf(
        '<style>.login h1 a{background-image:url("%s");background-size:contain;background-position:center;width:100%%;max-width:240px;height:100px;}</style>',
        esc_url( $logo_url )
    );
} );
```

## Notes

Order of preference: the URL in $logo_url, the Customizer logo, then the Site Icon.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Use Your Logo on the Login Page" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
