How to Add a Favicon to Your Website

Builders are always looking for new and innovative ways to improve their websites. One way to do that is by adding a favicon.

Favicons, or favorites icons, are tiny images that appear next to the URL in a web browser’s address bar. They can also be displayed in tabs and on bookmarks. Adding a favicon is a great way to make your website stand out from the competition and give your users a better experience.

Add a Favicon to Your Website

Below is a code snippet that will add a favicon to your website.

Place this in your theme’s functions.php file. Next, add a favicon.ico file inside of a folder called /images/ located inside of the theme.

// Add favicon to your website.
add_action( 'wp_head', 'add_site_favicon' );
function add_site_favicon() {

	echo '<link rel="shortcut icon" type="image/x-icon" href="' . get_template_directory_uri() . '/images/favicon.ico" />';


Alternatively, WordPress 5.9 introduces a feature that comes with the site logo block. Users can now set their site logo as their site icon (favicon).