What are Dashicons and How to Use Them in WordPress

March 11, 2025 by Andrew Smith

Dashicons are the official icon font of WordPress, introduced in version 3.8. They provide a simple way to add scalable, high-quality icons to the WordPress admin interface. These icons help improve visual appeal and user experience by replacing outdated images with modern vector icons.

What Are Dashicons?

Dashicons are a set of font-based icons specially designed for WordPress admin screens. Unlike static image icons, Dashicons are scalable, meaning they look crisp and clean on all screen sizes and resolutions. They also reduce the need for additional image assets, improving page load times.

WordPress includes Dashicons by default, so you don’t need to install any extra plugins or themes to use them. They are commonly used for:

  • Custom post type menu icons
  • Admin dashboard enhancements
  • Designing custom buttons or sections
  • Displaying icons in widgets, shortcodes, or front-end interfaces

How to Use Dashicons in WordPress

There are multiple ways to integrate Dashicons into a WordPress site. Below are the most common methods for adding them to an admin dashboard, front-end, or custom theme.

1. Using Dashicons in the WordPress Admin Menu

If you’re creating a custom post type or a plugin settings page, you can set a Dashicon as the menu icon using the menu_icon parameter. Here’s how:


function my_custom_post_type() {
    register_post_type('custom_type',
        array(
            'labels'      => array(
                'name'          => __('Custom Type'),
                'singular_name' => __('Custom Type')
            ),
            'public'      => true,
            'menu_icon'   => 'dashicons-admin-generic'
        )
    );
}
add_action('init', 'my_custom_post_type');

Simply replace dashicons-admin-generic with any other Dashicon class name found in the Dashicons resource list.

2. Enqueue Dashicons for Front-End Use

While Dashicons are automatically available in the WordPress admin area, they are not always loaded on the front end. To use them on your website’s front end, enqueue the Dashicons stylesheet in your theme:


function load_dashicons_frontend() {
    wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'load_dashicons_frontend');

Once this is added to your theme’s functions.php file or a custom plugin, you can use Dashicons anywhere on the site.

3. Adding Dashicons to Posts and Pages

To display Dashicons in a post, page, or widget, use simple HTML with the appropriate Dashicons class:



This will render a heart icon, which can be styled further using CSS if needed.

wordpress post

4. Styling Dashicons with CSS

Dashicons work like standard font icons, so they can be styled with CSS. Below is an example of how to customize size and color:


.dashicons {
    font-size: 24px;
    color: #0073aa;
}

This snippet makes all Dashicons 24px in size and changes the color to WordPress blue. You can also target specific icons by adding custom classes to your HTML structure.

Where to Find Dashicon Names

WordPress provides a full list of Dashicons in the official Dashicons reference. Each icon has a unique class name that you can use in your code.

Why Use Dashicons?

There are several advantages to using Dashicons in WordPress:

  • Lightweight: Since Dashicons are vector-based, they don’t add excess file size like image-based icons.
  • Scalable: They appear sharp on all screen sizes, including high-resolution displays.
  • Easy to Use: No extra dependencies are required since they come bundled with WordPress.
  • Consistent Design: Dashicons maintain a uniform style across the WordPress admin interface.
Common Causes of PHP Version Compatibility Issues in WordPress

Conclusion

Dashicons provide an easy way to enhance the WordPress admin experience with visually appealing icons. Whether you’re customizing the admin dashboard, developing a theme, or adding icons to the front end, they offer flexibility and ease of use. By following the methods outlined above, you can seamlessly integrate Dashicons into your WordPress projects and enhance user experience with clean, scalable icons.