To change the WordPress login page icon via code, add the following snippet to your theme’s functions.php file:

function custom_login_logo() {   
 echo '<style>#login h1 a { background-image: url(' . get_stylesheet_directory_uri() . '/images/custom-logo.png); }</style>';}add_action('login_enqueue_scripts', 'custom_login_logo');

Upload your logo to the theme’s /images/ folder, replacing custom-logo.png with your file name. This updates the login page logo without needing a plugin.

How to change WordPress login page logo

Another Example: –

function my_custom_login_logo() {
    echo '<style type="text/css">
        #login h1 a {
            background-image: url(' . esc_url('https://thefallen.in/wp-content/uploads/2024/08/634087ba6698e70e531fbcab_about-me-image-paperfolio-webflow-template.svg') . ') !important;
            width: 320px;
            height: 80px;
            background-size: contain;
            background-repeat: no-repeat;
        }
    </style>';
}
add_action('login_head', 'my_custom_login_logo');

The Fallen

I'm Ganesh, a passionate web designer from India with 2 years of experience crafting visually stunning and user-friendly websites.

Articles: 6

View all posts