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 am trying to create a custom Menu by using the WordPress add_menu_page() function. I think I understand the whole function parameters as Codex point it out as:

      add_menu_page( $page_title,
                     $position ); 

The only problem which I have is how to point to an existing WP icons liketool, edit, upload and so on.., in $icon_url? I already find this post but I coulnt' figute it out how to add style to div at:

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

inside of my .php file?!

share|improve this question
up vote 1 down vote accepted

The link you provided has the answer, given by Otto as a comment:

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.

As you said the syntax is:

syntax: add_menu_page( $page_title*, $menu_title*, $capability*, $menu_slug*, $function, $icon_url, $position ); - * required

So I used my custom icon (home.png), placed in a folder (/my_theme/admin/images/) as:

    'Site Options',                     // The title to be displayed on the corresponding page for this menu  
    'Site Options',                     // The text to be displayed for this actual menu item  
    'manage_options',                   // Which type of users can see this menu  
    'sandbox',                          // The unique ID - that is, the slug - for this menu item  
    'sandbox_menu_page_display',    // The name of the function to call when rendering the menu for this page
    get_bloginfo( template_directory ) . '/admin/images/home.png'   // Icon for the Main menu in Admin panel
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.