How To Customize the WordPress Admin Login Logo

Here’s a great quick tutorial that will let you customize the default administration (wp-admin.php) logo on the login screen. This can be a nice little WordPress trick to know especially if you’d like to impress your client a little bit, because after all, nothing feels quite like having to see your own brand or logo appear on your very own site.

So how do you do it? Well like most WordPress hacks, it involves adding a piece of code into your theme’s functions.php file. (NOTE: Be sure to back up your file first before proceeding.) Simply copy/paste the code below in aforementioned file:

// Custom Admin Logo
function my_login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(your_image_url);
padding-bottom: 20px;
}
</style>
<?php }
 add_action( 'login_enqueue_scripts', 'my_login_logo' );

Replace “your_image_url“ with the proper link to your image’s location. Also, make sure that your logo is no wider than 323 pixels and 67 pixels high. Otherwise, it’s going to look weird. Adjust the above padding-bottom value to the spacing you want between your logo and the login form.

We’re not finished yet. We still have to remove the logo link to the WordPress website and also the alt tag of “Powered by WordPress”. The following two scripts will be able to take care of that:

Changing the logo link

// Custom Admin Logo Link
function change_wp_login_url() {
echo bloginfo('url');
}
 add_filter('login_headerurl', 'change_wp_login_url');
Replace “url” with your own.

Changing the logo title and alt text

// Custom WP Login Title
function change_wp_login_title(){
echo get_option('blogname'); // Of your own text
}
add_filter('login_headertitle', 'change_wp_login_title');

Save your file.

And that’s basically how you do it. Credits to Marty Khoury for sharing this helpful trick!

Incoming search terms for the article:

Related Posts

Adding Expires Headers In Ruby On Rails

Validate Filename Before Uploading Image Using JavaScript

Logout Idle/Inactive Users Using PHP

Easy Customizations in WordPress Admin