Skip to content Skip to sidebar Skip to footer

Favicon Using Wordpress

I am trying to change favicon in wordpress. For which i have uploaded image in media and in theme customisation, under site identity i used that image as a favicon. Which is displa

Solution 1:

If your wordpress version is 4.2+, just add wp_head() in your header.php between <head> tags:

<?php wp_head(); ?>

You should be able to change the favicon from Administration Screen > Appearance > Customize now.

Function reference: wp_head()

Solution 2:

You can make it programatically through functions.php

First, create a function that includes the path to your favicon

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

Now, just make sure that function runs when you're on the login page and admin pages:

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

Post a Comment for "Favicon Using Wordpress"