Discuss your project
Wordpress Backoffice

WordPress: Add a favicon in the admin

No real interest in adding a favicon to the WordPress admin area, but a client may request it, which has already happened: function favicon(){ echo '<link rel="shortcut icon" href="',get_template_directory_uri(),'/images/favicon.ico" />',"\n"...

WordPress: Add a favicon in the admin

No real interest in adding a favicon to the WordPress admin area, but a client may request it, which has already happened:


function favicon(){
echo '<link rel="shortcut icon" href="',get_template_directory_uri(),'/images/favicon.ico" />',"\n";
}

add_action('admin_head','favicon');

Reproduce this customization today

The principle of the hook remains useful, but the administration screens and WordPress APIs have evolved since the publication. Test the code in a staging environment with the exact version of the site's core, theme, and plugins.

  • Save the files and the database before making any changes.
  • Control user capabilities, nonces, input validation, and output escaping.
  • Place customizations in a dedicated plugin or a child theme to preserve updates.

Reference: official WordPress plugin development manual.

Share this article