Add Custom CSS to WP Dashboard

October 20, 2021
Code Category:

Sometimes you just need to change some styles in the Dashboard. I recently needed to remove something from a plugin that was redundant with the function of a different plugin that did it better.

You can't just add CSS to your theme's style sheet if you need it to work in the Dashboard.

/*
	Add custom CSS to Dashboard / Admin area
*/
add_action('admin_head', 'custom_admin_styles');
function custom_admin_styles() {
  echo '
	<style>
		
	    div#wpmem-block-meta-id {
		display: none;
	    }

  	</style>
	';
}

You're basically just echoing CSS in PHP, so you have to be careful about single and double parenthesis.

©2021 Fotan Web Design