How to Change WordPress Login Logo and URL within Functions.php

One of the quickest and easiest tweaks you can do to your WordPress site is customising/ changing the WordPress logo and URL to your own branding/ theme’s style.

We all love WordPress and everything is had to offer but simply advertising the WordPress logo and URL on a client’s website isn’t exactly ideal. But simply by changing it to your own logo and site’s homepage make a huge difference and looks professional.

With the code below are two of the easiest ways of how to change WordPress login logo and URL within the functions file. We do it in here so that we don’t need to modify any of WordPress’s core structure as every so often WordPress release updates and if and when you update your core files this will be overwritten and lost. Thus having to re-do it again, but with this tweak you can apply it to the functions.php file held within your theme’s folder and not worry about this changing when updating the core.

The dimensions for the WordPress login logo are: 326px width x 67px height.

Change the Logo’s URL within functions.php

<?php
// custom wp login logo url
add_filter( 'login_headerurl', 'custom_loginlogo_url' );
function custom_loginlogo_url($url) {
	return 'http://www.rackmire.co.uk';
}
?>

Remember to change the web address ‘http://www.rackmire.co.uk’ to your own website’s URL, otherwise you’ll be linking to me.

Change the Logo image within functions.php

<?php
// custom wp login logo
function custom_login_logo() {
	echo '<style type="text/css">
	h1 a { background-image: url('.get_bloginfo('template_directory').'/images/rackmire-logo.png) !important; }
	</style>';
}
add_action('login_head', 'custom_login_logo');
?>

Don’t forget to change the filename ‘rackmire-logo.png’ to something more suitable and upload it to your theme’s images folder.
I’ve made the logo in .png as the logo image is transparent and suit any styled login page.

Save and Update from within the Appearance Menu or Save and upload the changes via FTP.

That’s it, you’re all done. Now you know how to change WordPress login logo and URL within functions.php file.

Remember when editing the functions.php file to not leave any white space after or line breaks after the closing PHP tag. – his can cause the ‘white page of death’ that is famous with WordPress.

If you have any questions or suggestions please let me know via the comments form below.