How to Change a Favicon in WordPress
WordPress gives you two routes for a site icon: the Site Icon field in the Customizer, or link tags you add in a child theme. One needs no code; the other gives you control over formats and paths. This guide covers both, the files they need, and the caching that makes a correct setup look broken.
Two routes, and how to choose
A favicon is a set of <link> tags in the page head plus the image files they point to. WordPress can write those tags from one uploaded image, or you can write them yourself. Use the Site Icon setting if one square image is enough; choose a child theme if you need an SVG or a fixed filename.
| Method | What it means in practice |
|---|---|
| Site Icon in the Customizer | Upload one square image; WordPress outputs the icon links and derived sizes. No code. |
| Child theme functions.php | Print the link tags with a wp_head hook; you control formats and paths. |
| A file at the site root | Place favicon.ico at the web root, a path browsers request by convention. |
| A plugin | Extra code to maintain for a task the two methods above already cover. |
Method 1: set the Site Icon in the Customizer
In a classic theme, open Appearance → Customize → Site Identity and find the Site Icon control. Select a square image from the media library, crop it if asked, then publish. WordPress stores the image, generates the sizes it needs, and prints the icon links on front-end pages.
Use a square source with a solid background and a simple mark. Fine detail disappears at tab size. The favicon size guide lists what each dimension is for.
Method 1 in block themes
With a block theme the Customizer may be reduced and the Site Icon control can move to the site editor. Check Appearance → Editor first, then fall back to Appearance → Customize. If the field is unavailable, use the code method below instead of editing parent theme files.
Method 2: output link tags from a child theme
A child theme keeps your changes when the parent theme updates. Hook into wp_head and escape URLs with esc_url(). The guard below skips your tags when a Site Icon is already set, so two competing sets of links never appear together.
Remove the guard and leave Site Icon empty if you want the child theme to win in every case. See ICO vs PNG for the format trade-off, and use the myfavicon generator to build the whole set from one square image in the browser.
// Child theme: functions.php
add_action( 'wp_head', 'mysite_favicon_links' );
function mysite_favicon_links() {
if ( function_exists( 'has_site_icon' ) && has_site_icon() ) {
return; // Site Icon already set in the Customizer
}
$base = get_stylesheet_directory_uri() . '/assets/';
echo '<link rel="icon" type="image/svg+xml" href="' . esc_url( $base . 'favicon.svg' ) . '">' . PHP_EOL;
echo '<link rel="icon" type="image/png" sizes="32x32" href="' . esc_url( $base . 'favicon-32.png' ) . '">' . PHP_EOL;
echo '<link rel="apple-touch-icon" sizes="180x180" href="' . esc_url( $base . 'apple-touch-icon.png' ) . '">' . PHP_EOL;
}
Which files to prepare
A practical set is one SVG, a small PNG for tabs, a larger PNG for home screen shortcuts, and a multi-size ICO as a root fallback. Apple touch icon explains the iOS image, while the web manifest and PWA icons cover installable sites.
| File | Purpose |
|---|---|
| favicon.svg | Scales cleanly for browsers that support SVG icons. |
| favicon-32.png | A small raster icon for tabs and bookmarks. |
| apple-touch-icon.png | iOS home screen image; use no transparency. |
| favicon.ico | Root fallback and legacy clients; can hold several sizes. |
Why the icon does not update
This is usually caching rather than a broken file. Browsers keep favicons for a long time, and a WordPress site may also have a page cache plugin and a CDN in front of it. Change one thing at a time so you can tell which layer is stale.
Verify the result
Read the rendered HTML rather than trusting the tab. The favicon checker inspects a live URL, and DevTools → Elements → head shows whether the links resolve. If a tag is missing or a path returns 404, see why a favicon is not showing for a general HTML walkthrough.
FAQ
No. The Site Icon field handles the common case, and a short wp_head hook in a child theme handles the rest.
Caching is the usual cause. Hard refresh, request the icon URL directly to confirm it updated, then purge any page cache and CDN cache.
An SVG stays sharp at any size and suits simple marks, but support is not universal and the iOS home screen uses a PNG. Shipping both is a workable setup.
You should not treat it as a ranking factor. Its job is recognition: a tab, a bookmark and a home screen shortcut become identifiable. Visibility depends on the content and the site.