Theme Development

Add Custom Favicon To Your WordPress Blog

A favicon (short for ‘favorites icon’), are little icons associated with a particular website shown next to the site’s name in the URL bar of most browsers. This will also appear in the tabs of the browser which makes your website easy to notice.

If your website has a custom favicon and you don't want to change the theme favicon then you can create a hook to add an action into the head tag.

The below snippet will add a link tag with the website URL plus the favicon link, just add this to the functions.php

// add a favicon to your
function blog_favicon() {
     echo '<link rel="Shortcut Icon" type="image/x-icon" href="'.get_bloginfo('url').'/favicon.ico" />';
add_action('wp_head', 'blog_favicon');
Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial