How to add favicon icon in your wordpress website


Hi, Today i will teach you how to add favicon icon in your WordPress website. it’s easy work. just you can open your header.php file in your current active theme, then you can find </head> tag, then you will input this code above/before your </head> tag.

<link type="image/x-icon" rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/img/favicon.ico">

You can use any img format example: .jpg, .png, ico, .gif etc… you  now you can input your favicon icon location in href you can see above codes. <?php echo get_template_directory_uri(); ?>/img/favicon.ico”> this is your favicon icon location. <?php echo get_template_directory_uri(); ?> code mean is your template location dynamically call then you will input your icon location

Or if you want to use functions.php file then you can input your this code in your functions.php file

function my_theme_add_favicon(){ ?>
<!-- Custom Favicons -->
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri();?>/img/favicon.ico"/>
<?php }

Thanks for reading this article, Don’t forget share this post in your social profiles.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!