Favicon using wordpress

I am trying to change the icon in wordpress. For which I uploaded the image to the media and in the theme settings, under the site ID I used this image as an icon.

What appears in my admin panel, but not in the website browser. I tried to check it, so it shows me below the line, but the image name does not appear in href

<link rel="icon" href="" type="image/x-icon">

So, for this I need to change my head of each php file with the appropriate code

<link rel="icon" href="http://my_url/image" sizes="32x32" />

but my question is, is there anyway where I can directly change it without going to the whole page title in wordpress.

I also tried clearing the cache and all other solution, but it did not work.

+4
source share
2 answers

wordpress 4.2+, wp_head() header.php <head>:

<?php wp_head(); ?>

"" > " " > "".

: wp_head()

+3

functions.php

,

 function add_favicon() {
      $favicon_url = get_stylesheet_directory_uri() . 'your_path';
      echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
 }

, ,
   add_action('login_head', 'add_favicon'); add_action('admin_head', 'add_favicon');

0

Source: https://habr.com/ru/post/1686869/


All Articles