How to add a custom icon to your custom post type

Here’s a quick way to add custom icon to your new custom post typeCustom Post Type WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept.’s menu item. It will replace the default pushpin image that your post type uses by default.

Before you paste the following code into your theme’s functions.php file, you’ll have to change two things:

  1. Replace the $icon_url value with the source to your custom image icon.
  2. Then change product in #menu-product to the actual name (not label) of your custom post type.
add_action( 'admin_head', 'my_custom_posttype_icon' );
function my_custom_posttype_icon() {
    $icon_url = esc_url( admin_url( 'images/generic.png' ) );
    <style type="text/css" media="screen">
        #menu-product .wp-menu-image {
            background: url(<?php echo $icon_url; ?>) no-repeat 6px !important;

Note: WordPress 3.0 will have a menu_icon parameter for the register_post_type() function.
This is just a quick workaround for the betaBeta A pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. release.

#functions, #icon, #post-type