Menu image for custom post type

I’m working with custom post type. I want to use custom menu image for the post type.
I know ‘menu_icon’ => ” should work but couldn’t recognize how image path should be specified. I appreciate your help.

Related posts

Leave a Reply

2 comments

  1. It is better to give the full path to the image. Something like this

    'menu_icon' => get_bloginfo('template_directory') . '/images/portfolio-icon.png'
    

    Edit: If you want to include the image from the Plugin directory, then you can use the plugin_url() function. This will make it compatible with WPMU as well.

    'menu_icon' => plugins_url('path/to/image',  __FILE__);
    
  2. Other way to do it, if the image you want to add is located in your theme directory, would be:

    'menu_icon' => get_template_directory_uri() . '/images/your_custom_icon.png',