Select Page

If you work with clients, you might want to replace the WordPress logo in the admin bar with your own custom logo. This code will also work for multisite WordPress installations.

Place this code in your theme’s functions.php file to replace the default WordPress admin logo with your own custom logo:

function set_custom_admin_logo() {
	$html = '<style type="text/css">';
	$html .= "#header-logo {";
		$html .= "background-image: url(" . get_bloginfo('template_directory') . "/custom_admin_logo.png) !important;";
	$html .= "}";
	$html .= "</style>";
	echo $html;
add_action('admin_head', 'set_custom_admin_logo');

For the above code to work, you need to place your logo inside your currently active theme’s directory. Replace custom_admin_logo.png with the name of your custom logo.

The above code adds an action for admin_head. This action will run inside the admin_head and it will output a CSS style that will replace the background image that is currently used for the admin header logo.