WordPress Shortcut Icon (Favicon)

In HTML, it’s relatively simple to add a Shortcut Icon, you would need to add the following between <head> and </head> in all your html pages:

<link rel=”shortcut icon” href=”http://www.domain.com/favicon.ico” type=”image/x-icon”>The word ‘shortcut’ is not always used (ie; rel=”icon” is ok), it’s added for backwards browser compatibility.

Only type=”image/gif”, type=”image/x-icon” and type=”image/png” are supported in all browsers.

You could do the same in WordPress by adding the above between the <head> </head> tags in header.php in the relevant theme (http://www.domain.com/wp-content/themes/theme/header.php).

However because the page is created dynamically, for correctness, the path is supplied as a variable:

<link rel=”shortcut icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico”>