Last active
January 30, 2024 14:45
-
-
Save knolaust/2f37b6a6a33530bb43135a86054f88a8 to your computer and use it in GitHub Desktop.
Replace WordPress Logo on Login Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Customize WordPress Login Logo. | |
* | |
* This code replaces the default WordPress logo on the login page with a custom logo. | |
* Update the URL to your custom logo and adjust the width and height accordingly. | |
* | |
* Gist Keywords: wordpress, admin, login | |
* | |
* @category WordPress | |
* @version 1.0.0 | |
* @author Knol Aust | |
*/ | |
add_filter( 'login_head', function () { | |
// Update the line below with the URL to your own logo. | |
$custom_logo = 'https://example.com/path-to-your-logo.png'; | |
$logo_width = 84; | |
$logo_height = 84; | |
printf( | |
'<style>.login h1 a {background-image:url(%1$s) !important; margin:0 auto; width: %2$spx; height: %3$spx; background-size: 100%%;}</style>', | |
$custom_logo, | |
$logo_width, | |
$logo_height | |
); | |
}, 990 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment