Created
April 6, 2025 05:26
-
-
Save maddisondesigns/275d9c4f009a3f5c6731711b08a53e9d to your computer and use it in GitHub Desktop.
Change logo and link on the WordPress 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
/** | |
* Change the logo on the WordPress login page from the WordPress logo to your own custom logo | |
*/ | |
function mytheme_change_login_logo() { | |
echo '<style type="text/css">#login h1 a {background:url(' . trailingslashit( get_stylesheet_directory_uri() ) . 'images/your-logo.svg)' . ' no-repeat center center;width: 100%;background-size: contain}</style>'; | |
} | |
add_action( 'login_enqueue_scripts', 'mytheme_change_login_logo' ); | |
/** | |
* Change the logo link on the WordPress login page from wordpress.org to your own site URL | |
*/ | |
function mytheme_change_login_logo_link( $url ) { | |
return home_url( '/' ); | |
} | |
add_filter( 'login_headerurl', 'mytheme_change_login_logo_link' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment