Request a Quote
Customer Focused
Web Services

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.

Give us a call (541) 784-5711

Start a converstation

©2024 Fotan Web Design