Changing and Overriding the WordPress Admin Logo Since 3.3.1

Since (near as I can tell) version 3.3.1, there are new style rules that control how the logo in the WordPress admin are displayed. Since this update, we’ll have to adjust the code that controls which custom styles are injected into the header. Here is the function (inserted into functions.php) which will correctly override the admin logo:

 

/**
 * customize the admin logo that appears in the header
 * http://www.wpbeginner.com/wp-themes/adding-a-custom-dashboard-logo-in-wordpress-for-branding/
 * @author Paul Bredenberg
 */
 
function htx_custom_logo() {
echo '
<style type="text/css">
#wp-admin-bar-wp-logo > .ab-item .ab-icon { 
	background-image: url(' . get_bloginfo('stylesheet_directory') . '/assets/images/dashboard-logo.png) !important; 
	background-position: 0 0;
	}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
	background-position: 0 0;
	}	
</style>
';
}
 
//hook into the administrative header output
add_action('admin_head', 'htx_custom_logo');

‹ "" | "" ›

17 Responses to Changing and Overriding the WordPress Admin Logo Since 3.3.1

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>