Branding WordPress login page with your custom logo

Branding the login page of your WordPress based website with a custom logo is very important. A custom logo will provide your WordPress website with a unique visual experience.

Branding a Wordpress login page with your clients’ logo before handing the Websites to them is really easy. You can achieve this by inserting the code snippet below into your theme’s functions.php file.

After adding the snippet you will need to change the image attachment id in the code with the id of the image you want to use. To get the id of your image head to the media library, find the image you want to use, click edit, then grab its id from the URL. The id actually is the number that shows after ‘post=’.  Your URL will be something like this: yourdomain.com/wp-admin/post.php?post=48&action=edit. As you can see the id of the image in this example is ’48’

PHP
add_action( 'login_head', 'wph_custom_login_logo' );

function wph_custom_login_logo() {

	$wph_new_logo = wp_get_attachment_image_src( 48, 'full' );
	echo '<style> .login h1 a { background-image: url( ' . $wph_new_logo[0] . ' ) !important; }</style>';

}

If you are using a different method for customizing your WordPress login page you can share it with us.