How to Add Custom CSS for the admin panel in WordPress?

In this post, we will discuss How to Add Custom CSS for the admin panel in WordPress.

Solutions #1

So first go to functions.php and paste the below code.

add_action('admin_head', 'my_custom_fonts');

function my_custom_fonts() {
  echo '
    a{
  padding: 12px 45px;
  display: inline-block;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 5px;
  margin-top: 5px;
  border-radius: 5px;
  border: 2px solid #fff;
  text-transform: uppercase;
}
  ';
}

Solutions #2

One CSS file adds on the admin panel.

So first go to functions.php and paste the below code.

add_action( 'admin_enqueue_scripts', 'load_admin_style' );
      function load_admin_style() {
        wp_register_style( 'admin_css', get_template_directory_uri() . '/admin-style-one.css', false, '1.0.0' );
//OR
        wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style-one.css', false, '1.0.0' );
       }

Two or more CSS file adds on the admin panel.

add_action( 'admin_enqueue_scripts', 'load_admin_styles' );
      function load_admin_styles() {
        wp_enqueue_style( 'admin_css_foo', get_template_directory_uri() . '/admin-style-one.css', false, '1.0.0' );
        wp_enqueue_style( 'admin_css_bar', get_template_directory_uri() . '/admin-style-two.css', false, '1.0.0' );
      }
What's your reaction?
0COOL0WTF0LOVE0LOL