Change the login page logo
Replaces the WordPress logo on wp-login.php with a file from your theme and links it to your site.
add_action( 'login_enqueue_scripts', function() {
$logo = get_stylesheet_directory_uri() . '/logo.svg';
echo '<style>#login h1 a{background-image:url(' . esc_url( $logo ) . ');background-size:contain;width:100%}</style>';
} );
add_filter( 'login_headerurl', fn() => home_url( '/' ) );
add_filter( 'login_headertext', fn() => get_bloginfo( 'name' ) );
These are the default values. Change them in the builder before you copy. Licensed under GPL-2.0-or-later, provided as is. Review and test it before using it on a live site.
How it works
The login page shows the WordPress logo, linked to wordpress.org. The snippet prints a few lines of CSS on login_enqueue_scripts that swap the image for a file from your theme. The two filters make the logo link to your homepage and use your site name as its text, which is also what screen readers announce.
Before you use it
- Upload the logo to your active theme’s folder, for example
wp-content/themes/your-child-theme/logo.svg. Use a child theme, or a theme update may delete the file. - Put the file name in the builder, under Logo file in your theme. A subfolder works too:
images/logo.svg. - The logo box is 84 pixels high and the logo scales to fit. An SVG, or a PNG at twice the size, stays sharp.
How to check it works
Open /wp-login.php in a private window. You should see your logo, linked to your homepage.
How to undo it
Remove the code. The WordPress logo comes back.
How to add this snippet
- Copy the code above.
- Paste it at the end of your child theme’s
functions.php, in Appearance → Theme File Editor or over FTP. - Save, then open the site and check that everything works. If something breaks, remove the code.
Need more than one? Open this snippet in the builder, turn on the others you want and copy them as one functions.php, or download them as a small plugin.
More in Admin
- Disable the admin email verificationStops the “is this email still correct?” screen that appears every 6 months after login.
admin_email_check_interval - Disable commentsCloses comments and pingbacks everywhere, hides existing ones and removes Comments from wp-admin. WooCommerce product reviews stay by default.
comments_open