Set Favicons for WordPress Site and Admin Area

A simple snippet can help set your favicons

This has been bothering me for a while, but not nearly enough to do something about it. On my multisite network, the admin area of my sites have taken the favicon of the main network site instead of the sites which they are an admin area for.

So I set about writing a quick function to rectify this. The following snippet sets the favicon for both your main site and admin area, where the favicon is a file called favicon.ico stored in your active theme folder:

If you wanted separate favicons for your admin area and your site, you can create two similar, but distinct functions, like this. Note the two different image links:

16 thoughts on “Set Favicons for WordPress Site and Admin Area”

  1. I have a question for you. The file…does it have to be a .ico image?

    1. It used to be that the file had to be a .ico file, but modern browsers have support for other file types now, mainly PNG. I use PNG files myself, though older browsers don’t support it. See

  2. Jasmine says:

    Good tip, I love that little fav icons.

  3. Melanie says:

    Hi Dave, this is very nice. I will try to apply this but I’m not a tech woman :(, I hope I can apply it. Thanks for sharing.

    1. There’s really not much to it Melanie. If you’re concerned, back up functions.php and if something goes wrong, you can just overwrite the changes you made.

  4. Xps says:

    Hey Dave. I don’t use WP as a multisite network (yet), but I found that some web services didn’t reflect my favicon even though it was properly coded in my theme’s <head> element. While traversing my site outside the Admin Dashboard, my browser didn’t have trouble displaying it. In order to display it site-wide and help out those web services, I simply copied the favicon to the site’s root directory. Now I see the icon inside the Dashboard and it looks mighty nice.

    1. Yeah, there’s a few places that it seems it will pick up on it, like the root of your website, and the active theme’s folder. Glad you got it working at any rate.

  5. jkd says:

    What if we put the favicon in the Functionality Plugin’s sub-directory, so that the favicon will be totally interdependent from themes image’s directory. Then we use the code like so:

    function admin_favicon() {
    echo ”;
    add_action(‘admin_head’, ‘admin_favicon’);

    Do think that is good idea!

    1. I think your code got a little lost there since it might not have been enclosed in code tags, but nonetheless, yes, you can put the image wherever you want and it might not be a bad idea to put it somewhere independent of the theme, assuming that your favicon is not going to change just because you change themes.

  6. Owen says:

    where do I enter the snipet?

      1. Owen says:

        Do I need to specify it for my particular favicon or is that above exact?

        1. You’ll need to modify the address for your own favicon.

          1. Owen says:

            it didn’t work so I used the short link and it still showed the old favicon called favicon.ico. so should I delete the old one from my theme directory?

          2. More than likely, the old one needs to be deleted from your theme files and there’s probably also a caching issue. Try viewing the page source to see which one is truly being loaded.

  7. Owen says:

    I removed the old two favicons from the file manager but that just made it worse! Now when I permanlink to a post and go on the register/login page it shows the first favicon and when I go into the admin pages it shows the 2nd favicon but on the acctuall site it does show the proper favicon!

Leave a Reply