WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have added a menu page to my plugin. In the wp codex is described that I can use a seperate .php file for the content of the menu.

function register_custom_menu_page() {
   add_menu_page('custom menu title', 'custom menu', 'add_users', 'myplugin/myplugin-index.php', '',   plugins_url('myplugin/images/icon.png'), 6);


   echo "Admin Page Test";

Now I want to use custom styles (.css) in the myplugin-index.php. How can this be achieved?



share|improve this question

migrated from stackoverflow.com Aug 16 '12 at 13:46

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

You could use

<!doctype html>
<style type="text/css">
display:none !important;
height:auto !important;
<div class="update-nag">
   echo "Admin Page Test";

You can enqueue this way

function prefix_add_my_stylesheet() {
        wp_register_style( 'prefix-style', plugins_url('style.css', __FILE__) );
        wp_enqueue_style( 'prefix-style' );
add_action( 'admin_enqueue_scripts', 'prefix_add_my_stylesheet' );

Reference: http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts#Example:_Load_CSS_File_on_All_Admin_Pages

share|improve this answer

You can use wp_enqueue_style.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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