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 use the add_menu_page function to add an new admin menu:


How to use one of WordPress' existing icons?

For instance, if I would like to use the "Posts" WordPress icon, by what must I replace 'wordpress_existing_icon' in the code above ?

I tried 'edit' and 'edit-posts' but it doesn't work.

share|improve this question
Short answer is that you can't. Not only using add_menu_page like that. Those icons WordPress uses are added as background images via CSS, not using the icon_url method that is provided with add_menu_page. – Otto Oct 20 '12 at 21:15
up vote 3 down vote accepted

add_menu_page(); as far as I can tell does not work with screen_icon or the default CSS parameters. The $icon paramater only takes 2 options, an url or div (well 3 if you leave it empty), so that leaves you with these options:

  1. Hard-code the link to the icons which are located in wp-includes/images/wpicons.png. This is an image slice of all the icons.

  2. Just cut out the icon you want in a photo editor and include it as a stand-alone image in your plugin folder like the codex example.

  3. Use the div parameter and define it via CSS. For example;


               'custom menu title', 
               'custom menu', 
               'div', //this part

To elaborate on the previous answer when using screen_icon('edit'); here is the list:

  • edit
  • upload
  • link-manager
  • edit-pages
  • edit-comments
  • themes
  • plugins
  • users
  • tools
  • options-general

You can also contain them in a div like :

<div id="icon-edit" class="icon32"></div>

Style reference: http://codex.wordpress.org/User:Wycks/Styling_Option_Pages:

share|improve this answer

When you call the screen_icon function, put the page id from which you want to get the icon. For instance, if you want posts icon, use either screen_icon('edit'); or screen_icon('post');

About here, you can leave it to false or null or maybe put "div" here. I read somewhere in the codex that "div" should be used whenever there's supposed to be some custom CSS

share|improve this answer
Sorry but there are problably something I don't understand. I can't use screen_icon('edit') function in my add_menu_page() function ? I want the small "Posts" icon before the label of my 'Custom_menu' – Gilles Vauvarin Oct 20 '12 at 20:31
not in this function, i meant in the function which outputs the html for the page – Mridul Aggarwal Oct 20 '12 at 21:06

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.