How to Use WordPress Dashicons (Posts, Menus and Post Types)
Dashicons are the icon font that ships with WordPress. WordPress uses them for the icons in the admin menu, and you can use them on your own site too. To show a Dashicon on the front end, load the Dashicons stylesheet, then add an element such as <span class="dashicons dashicons-admin-home"></span> wherever you want the icon.
This guide shows how to find the right icon, load Dashicons on the front end, and use them in posts, menus, widgets and custom post types, plus how to resize and color them without the usual clipping problems.

What Are Dashicons?
Dashicons became the official icon font of the WordPress admin in WordPress 3.8. The official Dashicons library lists around 340 icons in about 20 categories, from admin and post formats to social and media icons.
Because they’re a font, they scale to any size and take their color from CSS. Two limits are worth knowing before you build a design around them:
- The set is frozen. The Dashicons project is no longer accepting icon requests, so the library won’t grow. If you need an icon that doesn’t exist, use an SVG icon or an icon block instead.
- They aren’t loaded for visitors by default. WordPress loads Dashicons on the front end only when the admin toolbar is showing, so you see your icons while logged in but logged-out visitors usually see nothing, unless your theme or a plugin already loads them. The next section fixes that.
Find the Icon and Copy Its Code
Open the Dashicons library and browse or search for an icon.

Click an icon to see its details. Copy the CSS class, such as dashicons-format-gallery, if you need it for a menu or custom post type.

To place the icon in content, click Copy HTML instead. This gives you a ready-made element such as <span class="dashicons dashicons-format-gallery"></span>.

Common Dashicons Quick Reference
This table covers 24 icons that suit common front-end jobs such as navigation, contact details, shopping and social links. Use the class in HTML or a menu, and the code in CSS. I checked each one against the Dashicons stylesheet in WordPress 7.1.3.
| Icon name | Class | CSS code |
|---|---|---|
| Home | dashicons-admin-home | \f102 |
| Post | dashicons-admin-post | \f109 |
| Page | dashicons-admin-page | \f105 |
| Media | dashicons-admin-media | \f104 |
| Comments | dashicons-admin-comments | \f101 |
| Users | dashicons-admin-users | \f110 |
| Search | dashicons-search | \f179 |
| Menu (hamburger) | dashicons-menu | \f333 |
| Lock | dashicons-lock | \f160 |
dashicons-email | \f465 | |
| Phone | dashicons-phone | \f525 |
| Location | dashicons-location | \f230 |
| Calendar | dashicons-calendar-alt | \f508 |
| Clock | dashicons-clock | \f469 |
| Cart | dashicons-cart | \f174 |
| Star | dashicons-star-filled | \f155 |
| Heart | dashicons-heart | \f487 |
| Video | dashicons-format-video | \f126 |
| Download | dashicons-download | \f316 |
| External link | dashicons-external | \f504 |
dashicons-facebook | \f304 | |
dashicons-instagram | \f12d | |
dashicons-linkedin | \f18d | |
dashicons-whatsapp | \f19a |

For all of the roughly 340 icons, with previews, use the official Dashicons library.
To show an icon without extra HTML, add it with a CSS pseudo-element. This example puts a phone icon before any link with the class phone-link:
.phone-link::before {
font-family: dashicons;
content: "\f525";
vertical-align: middle;
margin-right: 4px;
}
This still needs the Dashicons stylesheet on the front end, so add the code from the next section first.
Load Dashicons on the Front End
Add this code to your child theme’s functions.php file, or to a code snippets plugin. Don’t add it to a parent theme, because a theme update would remove it.
function howtowp_enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'howtowp_enqueue_dashicons' );
If you use the built-in editor, go to Appearance > Theme File Editor (or Tools > Theme File Editor on block themes).

Select Theme Functions (functions.php) on the right.

Paste the code at the end of the file.

Click Update File.

Back up the site before editing theme files. A typing mistake in functions.php can take the whole site down. If that happens, remove the code over SFTP or your host’s file manager, and follow this guide to fixing the critical error if the site still won’t load. A code snippets plugin is safer because it can catch and disable a broken snippet.
To confirm it works, open your site in a private browser window where you aren’t logged in, and check that the icon you add in the next step appears.
Add Dashicons to Posts and Pages
In the block editor, use a Custom HTML block. If you’re new to it, my guide to adding HTML to WordPress covers the block step by step. Open the post or page you want to edit.


Add a Custom HTML block where you want the icon.

Click Edit code on the block, paste the HTML you copied into the HTML tab and click Update. Add aria-hidden="true" so screen readers skip the decorative icon, and keep any meaningful text next to it:
<span class="dashicons dashicons-format-gallery" aria-hidden="true"></span> Photo gallery

Click Save (or Publish for a new post).

View the post to check the icon.

On classic themes, go to Appearance > Menus. If you need a copy of a menu to experiment on first, see how to duplicate a menu in WordPress.

Add the page you want to the menu, then expand it under Menu Structure.


If you’re an administrator, menu labels accept HTML, so put the icon element in the Navigation Label field before the text. On multisite, where only Super Admins have the unfiltered_html capability, or for any user without it, WordPress strips the span, so use the CSS class method below instead:
<span class="dashicons dashicons-admin-home" aria-hidden="true"></span> Home
Pasting only the class name into the Navigation Label, such as dashicons-admin-home Home, doesn’t work because it shows the class name as text. Click Save Menu, then check the menu while logged out.
Block themes use the Navigation block instead of this screen. Select the link, open the settings (gear) tab in the block sidebar and type dashicons-before dashicons-admin-home in Advanced > Additional CSS class(es). The dashicons-before class tells the Dashicons stylesheet to draw the icon before the link text. I tested this on a Navigation link in Twenty Twenty-Five, and the same two classes work in the CSS Classes field on the classic Menus screen (turn it on under Screen Options).

Check the result on the front end while logged out.
Add Dashicons to Widgets
Widget areas use blocks too. On a classic theme, go to Appearance > Widgets, add a Custom HTML block to the widget area, and paste the same kind of element you used in posts. Click Update to save the widgets.

Block themes such as Twenty Twenty-Five don’t have a Widgets screen. Their sidebars and footers are template parts, so go to Appearance > Editor > Patterns, open the template part you want to change, such as Footer, add a Custom HTML block where you want the icon and click Save. The icon then appears on every page that uses that template part.
Give a Custom Post Type a Dashicon
A custom post type shows a generic pin icon in the admin menu unless you set one. (For other admin tweaks, see my guide to customizing the WordPress admin dashboard.) In code, pass the icon class as menu_icon when you register the post type:
register_post_type( 'book', array(
'label' => 'Books',
'public' => true,
'menu_icon' => 'dashicons-book',
) );
Admin pages you add with add_menu_page() accept a Dashicons class in the same way. Both fields also accept a base64-encoded SVG data URI if you want an icon that isn’t in the set.
If you created the post type with the Custom Post Type UI plugin, go to CPT UI > Add/Edit Post Types and select your post type.


Under Menu Icon, click Choose dashicon.

Pick an icon.

Click Save Post Type (or Add Post Type if you’re creating a new one). The new icon appears in the admin menu.

You don’t need to load Dashicons in the admin. WordPress already loads them on every admin screen.
Change Dashicon Size, Color and Hover Effects
Go to Appearance > Customize > Additional CSS, or Appearance > Editor > Styles on block themes, then open the More (⋮) menu and choose Additional CSS.


Size: Dashicons have a fixed width and height of 20 pixels. If you only change font-size, larger icons get cut off. Change all three together:
.dashicons {
font-size: 32px;
width: 32px;
height: 32px;
}

Color: icons use the text color, so set color:
.dashicons {
color: #d54e21;
}
Hover: change the color when a visitor points at a linked icon:
a:hover .dashicons {
color: #0073aa;
}
In the Customizer, click Publish. In the Site Editor, click Save. These rules affect every Dashicon on the front end. To style one icon only, add your own class to it, for example <span class="dashicons dashicons-star-filled rating-star">, and target .rating-star.

Make Dashicons Accessible
- Add
aria-hidden="true"to decorative icons so screen readers don’t announce them. - If an icon is the only content of a link or button, add text for screen readers, for example
<span class="screen-reader-text">Search</span>. - Don’t rely on an icon alone to explain an action. Pair it with a visible label where you can.
- Check that icon colors have enough contrast with the background.
Troubleshooting Dashicons
| Problem | Likely cause and fix |
|---|---|
| Icons show when logged in but not for visitors | Dashicons aren’t loaded on the front end. Add the code from the Load Dashicons on the Front End section. |
| An empty square or nothing appears | The class name is misspelled, or the element is missing the base dashicons class. Use both classes, for example dashicons dashicons-admin-home. |
| Large icons are cut off | Only font-size was changed. Set width and height to the same value. |
| The menu shows the class name as text | The class was pasted as plain text. Use the full <span> element in the label, or put dashicons-before dashicons-admin-home in the CSS Classes field. |
| The icon doesn’t show in the editor or the Edit code preview | The editor preview doesn’t load the Dashicons font. Save the post and check the icon on the front end. |
| The site broke after editing functions.php | Remove the code over SFTP or your host’s file manager, then add it again with a code snippets plugin. |
Frequently Asked Questions
Why are Dashicons not showing on the front end?
By default, WordPress doesn’t load the Dashicons stylesheet for logged-out visitors, so icons that look fine while you’re logged in disappear for everyone else. Enqueue the dashicons style on wp_enqueue_scripts with the code in the Load Dashicons on the Front End section, then test in a private window.
Can I add my own icons to Dashicons?
No. Dashicons is a fixed icon font and no longer accepts new icons. For a custom post type or admin page, you can use a base64-encoded SVG as the menu_icon instead. On the front end, use an SVG or an icon block.
Do Dashicons slow down my site?
The stylesheet and font are small, but loading them on every page is wasted work if you only use one or two icons. For a single icon, an inline SVG is lighter. Many themes and block plugins also include their own icon sets.
Are Dashicons deprecated?
No. They are still the icon font of the WordPress admin and still work on the front end. The project has simply stopped adding new icons.


Hey Muhammad, thanks for writing this post, very informative! I have a question if you don’t mind, how can I change the search icon on the upper right corner of the WordPress site to the dashicons-search? This I couldn’t do in the menu section and I couldn’t figure out how to do this with CSS. Can you help? Thanks!
Hey Charice,
Absolutely! I’m glad you found the article informative. To change the search icon on your WordPress site to the “dashicons-search”, you’ll need to use some CSS. Here’s a step-by-step breakdown for you:
Step 1: First, make sure you have the “Dashicons” font enqueued on your site. If you’re using the WordPress admin, it’s already enqueued for you.
Step 2: Go to the “Appearance” section in your WordPress dashboard.
Navigate to “Customize.”
Step 3: From there, go to the “Additional CSS” section.
Step 4: In the “Additional CSS” box, enter the following code:
.your-search-icon-selector:before {
content: “\f179”;
font-family: “dashicons”;
}
Note: Replace “.your-search-icon-selector” with the actual CSS selector for your search icon. If you’re not sure about the selector, right-click on the icon on your site, choose “Inspect”, and identify the relevant CSS class or ID.
Step 5: After pasting, click “Publish.”
This will replace the current search icon with the “dashicons-search” icon. If you face any issues, let me know! Always here to help.
Best wishes,
Shakeel