How can I change the menu icon (coming from external plugins, like WooCommerce) in wp-admin area with custom icon? (The menu-item is actually post-type, so there should be some register_post_type command i think).

2 Answers 2


WooCommerce styles the icon via this CSS file: woocommerce/assets/css/menu.css, and here's the corresponding code (pretty-printed or actually, I copied it from woocommerce/assets/css/menu.scss):

#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before {
    font-family: 'WooCommerce' !important;
    content: '\e03d';

So you can change the font-family and the content (and other) properties to suit your custom icon.

Below is an example of customizing the icon by changing it to use a background-image:

// We hook to the `admin_enqueue_scripts` action with a priority of `11`, where
// at this point, the default CSS file should have been loaded. But you can or
// should add the CSS rule to your custom CSS file; just make sure it's loaded
// *after* the default CSS file.
add_action( 'admin_enqueue_scripts', function(){
    $css = <<<EOT
#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before {
    content: ' ';
    background: url('https://png.icons8.com/dusk/2x/e-commerce.png') no-repeat center;
    background-size: contain;

    wp_add_inline_style( 'woocommerce_admin_menu_styles', $css );
}, 11 );

Note: The menu.css file is registered and queued in WC_Admin_Assets::admin_styles() with the handle/name of woocommerce_admin_menu_styles.


to add a custom image, you can use this code. the original image is set with CSS then you have to add custom CSS to remove that.

add_action("admin_menu", function () {

    foreach ($GLOBALS["menu"] as $position => $tab) {

        if ("woocommerce" === $tab["2"]) {
            $GLOBALS["menu"][$position][6] = "http://server/image.png";


  • I forgot to mention that the custom icons are fonts files, How can I override it with it instead of image? Jul 16, 2018 at 5:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.