How To Show Your Favicon on Your WordPress XML Sitemap

Have you ever wondered why your WordPress website's favicon doesn't show on your XML Sitemap? If YES, then note that your WordPress theme has not been properly configured.

On this post, I will go directly to showing you on how to configure your WordPress theme so your favicon could show on your XML Sitemap.

Steps on How To Show Your Favicon on Your WordPress XML Sitemap

There are many ways in which you can fix this issue. This can be done through your WordPress dashboard, cPanel or via an FTP like FileZilla. Here I will only be showing you that of the cPanel from the steps below.

Step 1: Log in to your cPanel.


Step 2: Copy the favicon (must be in a .ico format with width 16 x height 16) you want to use in your root directory (public_html). If you have more than one website hosted in the same cPanel, copy to the root directory of that website.


Step 3: After copying the favicon to your root directory, navigate to your theme (the folder where your theme is been installed usually wp-content/themes/yourthemename/) and edit header.php.


Step 4: Now on the header.php edit tab, you will see a code like the one shown below:

Code:

<!doctype html> <html lang=en-US> <head> <meta charset="UTF-8"> <link rel=icon href=/wp-content/themes/----/favicon.ico type=image/x-icon /> <link rel="shortcut icon" href=/wp-content/themes/-----/favicon.ico type=image/x-icon /> <SOME CODES MISSING!!"><SOME CODES MISSING!!"};</script> </head> <body>



Step 5: Edit the code in Step 4 to look like the code below by replacing the highlighted lines in blue text with your website's URL):


Code:

<!doctype html> <html lang=en-US> <head> <meta charset="UTF-8"> <link rel=icon href=https://roshillzz.net/favicon.ico type=image/x-icon /> <link rel="shortcut icon" href=https://roshillzz.net/favicon.ico type=image/x-icon /> <SOME CODES MISSING!!"><SOME CODES MISSING!!"};</script> </head> <body>


Step 5: Save changes.


Congratulations! You have successfully configured your WordPress XML Sitemap to show favicon.

Now clear your browser's cache or use incognito mode to see results. If you are using Cloudflare, then you should also login to your dashboard >> Select website >> Caching, then Purge Everything.

N.B: 
In the above Step 5, instead of using a full URL of your website, you can simply edit the link to /favicon.co only. (href=https://roshillzz.net/favicon.ico = href=/favicon.ico)

Screenshot used or cPanel directories could vary depending on your Web Hosting company. If you are looking for where to create a favicon, then head to favicon-generator.org.

Cheers, Hope this Works!