Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 Aug 16 '12 at 13:46

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

2 Answers 2

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' );


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.