How to change login screen logo in WordPress?

How to change login screen logo in WordPress? is one of the most important question asked by customer when you develop site for them in WordPress. Today I am going to show you how to write simple function in WordPress that you can include in functions.php or can create standalone WordPress plugins to change your home page login screen logo.

How to change login screen logo in WordPress?
/**
*Change Login Screen logo
*/
function nowhow_custom_login_logo()
{
echo '<style type="text/css"><!--
		h1 a { background-image:url('.get_bloginfo('template_directory').'/images/nowhow.png) !important; 
		background-size: 300px !important;
			    width: 300px !important;
		}--></style>';
}
//hook to admin login screen
add_action('login_head','nowhow_custom_login_logo');

If you are using OOP concept to code as a plugin, you can include the code in functions.php in following way.

<?php 
/*
 Plugin Name: Nowhow System
 Author: dr.code.skm
 Author URI: www.skmukhiya.com.np
 Description: This is custom plugin made for nowhow.no to publish same funcitonality thorought all the multisite domains
 */

class nowhow
{
	public function __construct()
	{
		//hook to admin login screen
		add_action('login_head', array($this, 'nowhow_custom_login_logo'));
	}


	/*
	 * Change Login Screen logo
	 */
	public function nowhow_custom_login_logo() {
		echo '<style type="text/css"><!--
		h1 a { background-image:url('.get_bloginfo('template_directory').'/images/nowhow.png) !important; 
		background-size: 300px !important;
			    width: 300px !important;
		}--></style>';
	}
}
new nowhow();

?>

Here, I have used admin hook called login_head to change the logo of the login screen. You can use this plugin or place the code in functions.php. But, in order for this code to work, make sure, you have images folder inside your theme folder and the logo png file. Please rename the logo name to match your context. This filter can be used to place custom things on the login screen.

I hope this post is helpful. If you are successful, doing login screen comment out to show how you did your implementation.

About the Author

dr.code.skm

I am backend developer with passion in Web Application development using latest technologies like Laravel, PHP7, React, ECMAScript 6 and WordPress. I prefer spending time analyzing big data with Apache Spark. Apart from that, I do photography.