I am having troubles with my favicon. I have a WordPress site and I use this code to display the favicon in my functions.php:
function add_my_favicon() {
$favicon_path = get_stylesheet_directory_uri() . '/favicon.ico';
echo '<link class="favicon" rel="icon" type="image/x-icon" href="' . $favicon_path . '?" />';
echo '<link class="favicon" rel="shortcut icon" type="image/x-icon" href="' . $favicon_path . '?" />';
}
add_action( 'wp_head', 'add_my_favicon' ); //front end
add_action( 'admin_head', 'add_my_favicon' ); //admin end
Everything good so far. It works on my homepage site but it does not on all the other sites. For example the favicon is missing on my product detail site. The html source code is loaded correctly everytime but it seems that chrome is somehow overwriting my stylesheet with:
user agent stylesheet:
link {
display: none;
}
It tried also with Firefox and there it works without problems. Only Chrome is buggy. I disabled also Adblock for my site and still the same issue.
Any more ideas?