I tried the following:


function my_wp_admin_css() {
  echo '<link rel="stylesheet" href="/wp-content/plugins/custom-admin-style/wp-admin.css" type="text/css" />';


but nothing is being displayed in the Wordpress admin.

What I'm doing wrong?


You need to use wp_enqueue_style and hook it into admin_print_styles

add_action( 'admin_print_styles' , 'my_wp_admin_css' );

function my_wp_admin_css() {

      wp_enqueue_style('my_admin_style' , WP_PLUGIN_URL . '/myPlugin/stylesheet.css' );

If you just want the stylesheet on your plugins page you can use:

$mypage = add_management_page( 'myplugin', 'myplugin', 9, __FILE__, 'myplugin_admin_page' );
add_action( "admin_print_styles-$mypage", 'myplugin_admin_head' );
function myplugin_admin_head() {
    // what your plugin needs in its <head>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.