Roots Discourse

Correct way to place the favicon in Sage 9

Sorry for the basic question. There is an old thread but I think maybe things have changed.

So, I have a favicon of 16x16. Normally I would put the favicon in the theme root and it worked, but I want to do things as it’s supposed to, as standard as possible. So I guess there are some options:

  • Keep it under resources and WP will automatically take it.
  • declare it under head.
  • Use the WP favicon option (which forces to use 512x512 favicon).

What option do you recommend?

The team might kick me out for this, but I use a plugin:

This way the designers or content people can take care of the favicon, and you get all the sizes and devices in the deal.


amazing as always! thank you so much

I personally just pick it in the Customizer (the third option you mentioned)–don’t know if there are any drawbacks to that approach vs the plugin @MWDelaney linked to. Haven’t spotted any so far.

Things have probably gotten better with WordPress’s default icon generation since this post was written but at the moment the default customiser cuts and links four images out of a 512x512 icon: 270x270, 180x180, 192x192, 32x32.

I’ll keep my plugin count down use this method unless anyone knows of a good reason to use the above plugin instead.

I just use the default WordPress favicon feature in Customize > Site Identity.

I don’t use the Plugin, but I do use its web implementation in and put it in head section.

Why? It gives me a lot of control of how will it be seen in all situations and even sets the browser color (in android you can theme the browser as well) and the touch bar in case of Safari.

Furthermore, I usually create 2 favicons, one in color and one in grey to easily difference the admin of wordpress from the real site.

@mmirus I’m using the customizer way now but I can’t understand how the favicon is displayed on my pages.
I can see the icon on the browser tab but I don’t know were it came from.
There is no trace of it in the network file requested neither in the html output of the pages.
I also tried to search for it in the wordpress codebase but with no luck.

The problem is I’d like to implements also this solution:

@SergiArias how did you handled this?
putting files in resources/assets/images/favicons/ and using get_stylesheet_directory_uri()?

how did you handled this?
putting files in resources/assets/images/favicons/ and using get_stylesheet_directory_uri()?

Just implemented the files from RealFaviconGenerator, just use blade’s @asset() directive like this:

<link rel="apple-touch-icon" sizes="180x180" href="@asset('images/favicons/apple-touch-icon.png')">