Is there a way for me to replace the icons in the WordPress Dashboard with custom ones? I’m imagining there’s got to be a way to do this with the functions.php
or, more ideally, with a custom-built plugin, but I have no idea how to do that kind of stuff, and Google has failed me. In particular, I’m looking to replace the Yoast SEO icon with a gray one to match the WordPress theme better:
2 comments
Comments are closed.
Yes, you can replace existing icons by overwriting them via CSS.
Make sure to check if the existing icon is set via
img
orbackground-image
and add some CSS to overwrite it with one of the available icons. You can find all available icons and the appropriate selector at the Dashicons Website.To replace the icon of the Yoast SEO Plugin you can add this snippet to your
functions.php
:Further Reading: There is also a nice in depth tutorial from Shea Bunge about Replacing WordPress Admin Menu Icons.
UPDATE: There will be a white icon in the future 🙂
UPDATE 2: Implemented with v1.6.1
Dashicons to the rescue! Dashicons are the icon font that ships with WordPress 3.8+ by default and powers all the core menu icons.
Start by registering a custom stylesheet for your theme’s admin-specific styles in
functions.php
.(I actually prefer to do this in a custom
mu-plugin
which requires a slightly different snippet, but I’ll go with a theme admin styles for this answer.)Then make that stylesheet—this example has it in the
/css/
folder of the active theme—and use a rule like this to target the icon with the right content value to get the icon of your choosing (find these on that dashicons link above):That icon is the wrench icon from Dashicons that actually looks kind of like the negative space in the default icon.
While the color and hover state are probably overkill and actually counter to the reason you want to replace the icon in the first place, I include them just to point out that you can use CSS to styles these icons however you want.