When I put this code in my functions.php
add_action('wp_head', 'my_favicon');
function my_favicon() {
echo "<link rel='shortcut icon' href=' " . get_stylesheet_directory_uri() .
'/images/favicon.ico'"'>";
}
I get
[Message from webpage]: There has been a critical error on this website. Learn more about debugging in WordPress.
What’s wrong with my code?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
add_action('wp_head', 'my_favicon');
function my_favicon() {
echo "<link rel='shortcut icon' href='" . get_stylesheet_directory_uri() .
"/images/favicon.ico'>";
}
I think the problem was incorrect quotation marks on the string.
Can you try this code.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0