Last active
May 8, 2026 18:34
-
-
Save endurtech/c3655fbf87423625fee8fd23b5487311 to your computer and use it in GitHub Desktop.
Snippet to change the default WordPress login logo, link, and title. https://endurtech.com/replace-wordpress-login-logo-link-title/
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 | |
| // Replaces the WordPress Login Logo, Link, & Title | |
| // https://endurtech.com/replace-wordpress-login-logo-link-title/ | |
| # WordPress Login Logo Replacement | |
| add_action( 'login_enqueue_scripts', 'endurtech_login_logo' ); | |
| function endurtech_login_logo() | |
| { | |
| # Use echo below if image resides in your Media Library | |
| echo '<style>#login h1 a{background-image:url(' . home_url() . '/wp-content/uploads/YYYY/MM/custom-logo.png) !important; background-size:contain !important; width:100% !important; height:100px !important;}</style>'; | |
| # Use echo below if image resides in your Themes Directory | |
| # echo '<style>#login h1 a{background-image:url(' . get_stylesheet_directory_uri() . '/images/custom-logo.png) !important; background-size:contain !important; width:100% !important; height:100px !important;}</style>'; | |
| } | |
| # WordPress Login Link Replacement | |
| add_filter( 'login_headerurl', 'endurtech_login_logo_url' ); | |
| function endurtech_login_logo_url() | |
| { | |
| # Just links to sites' homepage | |
| # Replace home_url() with your custom URL | |
| return home_url(); | |
| } | |
| # WordPress Login Title Replacement. Replaces 'Powered by WordPress'. | |
| add_filter( 'login_headertitle', 'endurtech_login_logo_url_title' ); | |
| function endurtech_login_logo_url_title() | |
| { | |
| # Just displays the sites' name | |
| # Replace get_bloginfo('name') with your custom title. Example 'Managed & Maintained by ENDURTECH'; | |
| return get_bloginfo('name'); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment