How to Add Custom Code in the WordPress Admin Head?

25/01/2026

Use the add_action('admin_head', 'function_name'); to add custom code in the WordPress admin <head>.

/* Add Custom Code in Admin Dashboard */
add_action('admin_head', 'my_custom_code'); 

function my_custom_code() {

echo '<style>
         .p {font-size: 18px;}
         #dashboard_activity{display: none;}
      </style>';}

You can customize the admin panel with custom codes however you like.