How to Add Favicon to WordPress Admin & Login Page

Favicon is nothing but a site identity. This icon is displayed on the browser tab. It’s helpful to find out the exact site from many opened tabs. Usually, users put a favicon on the front end. To add a favicon you simply need to use the below line inside the head tag.

<link rel="icon" href="PATH_TO_FAVICON" />

But when it comes to the backend of WordPress, you can’t easily find the head tag. It’s present somewhere inside the core files of WordPress. We should never edit core files as WordPress updates are coming regularly and it replaces most core files.

However, there is a way to achieve it. In this short tutorial, I show you how to add a favicon to WordPress admin and login pages.

Add Favicon to WordPress Admin & Login Page

WordPress provides hooks to inject custom code at the desired places. Here, we need to insert code to the head section of the login and backend pages. For this, we have to use two hooks –  login_head and admin_head. These hooks automatically add the code from the callback method to the head section of the respective pages.

Keep your favicon (say favicon.png) in your active theme’s directory. And then include the below code in the theme’s functions.php file.

function add_site_favicon() {
    printf('<link rel="icon" href="%s" />', get_stylesheet_directory_uri() . '/favicon.png');
add_action('login_head', 'add_site_favicon');
add_action('admin_head', 'add_site_favicon');

That’s it! Now when you visit the login page and dashboard you should see your favicon in the browser tabs.

Related Articles

If you liked this article, then please subscribe to our YouTube Channel for video tutorials.

1 thought on “How to Add Favicon to WordPress Admin & Login Page

Leave a Reply

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