Did you know that you can change the default style of WordPress admin area? You can do it by overriding the old stylesheet. To do this, you have to create a new css file in your theme folder, and then include it in WP-Admin using the admin_head hook.
In this article, we’ll show you how to customize your WordPress dashboard by overriding the old stylesheet.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
Make sure to change paths and then upload the new stylesheet in the correct location place that you want to override. Location: /wp-admin/css/colors-fresh.css. You might want to copy the old stylesheet and use as a template for your new one.
<?php function customAdmin() { $url = get_settings('siteurl'); $url = $url . '/wp-content/themes/my-theme/styles/wp-admin.css'; echo '<!-- custom admin css --> <link rel="stylesheet" type="text/css" href="' . $url . '" /> <!-- /end custom adming css -->'; } add_action('admin_head', 'customAdmin'); ?>
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 62 best free WordPress blog themes or 7 best WordPress contact form plugins.
This code used to work but no longer works due to the change in the WP core. Basically, there is a function that removes injected css in the core file now. (probably due to a security reason) I haven’t figured out a way to bypass this.
Really frustrating.
It was probably the server or your device not rendering them. I’ve noticed the same thing while viewing code on certain sites/devices
Not sure why you are mixing html entities (e.g. <) with the characters themselves (e.g. >). To get this to work, I used ‘<' instead of '$lt;'.