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

<?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');
?>

Advertise here 50% Off

Comment