Clients love seeing their logo when they login to their site.
With the help of some wise people in the WPDevDesign Facebook Group, the following code snippet lets you easily change the standard WordPress logo and link on the login page.
Add the following code snippet and set to run everywhere.
You only need to change the URL of the logo you want to show and adjust the width, height and background size to suit the aspect ratio of the logo.
function login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(https://yourwebsite.com/wp-content/uploads/2021/12/logo-file.png);
background-position: center center;
height: 90px;
width: 90px;
background-size: 90px;
object-fit: cover;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'login_logo' );
//Custom logo URL
function login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'login_logo_url' );
function login_logo_url_title() {
return 'Link title';
}
add_filter( 'login_headertitle', 'login_logo_url_title' );
Thats it! I hope you find this useful.