Title: favicon | Make WordPress Core

---

#  Tag Archives: favicon

 [  ](https://profiles.wordpress.org/audrasjb/) [Jb Audras](https://profiles.wordpress.org/audrasjb/)
10:11 am _on_ February 19, 2020     
Tags: [5.4 ( 53 )](https://make.wordpress.org/core/tag/5-4/),
[dev-notes ( 650 )](https://make.wordpress.org/core/tag/dev-notes/), favicon   

# 󠀁[Enhancements to favicon handling in WordPress 5.4](https://make.wordpress.org/core/2020/02/19/enhancements-to-favicon-handling-in-wordpress-5-4/)󠁿

WordPress 3.0 introduced `[wp_favicon_request()](https://developer.wordpress.org/reference/functions/wp_favicon_request/)`
to avoid the performance hit that comes from serving a full 404 page on every favicon
request. While that function works as intended, it doesn’t offer enough flexibility.

As of WordPress 5.4, theme and pluginPlugin A plugin is a piece of software containing
a group of functions that can be added to a WordPress website. They can extend functionality
or add new features to your WordPress websites. WordPress plugins are written in
the PHP programming language and integrate seamlessly with WordPress. These can 
be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
or can be cost-based plugin from a third-party. authors can manage favicon requests
much more flexibly, with the following logic:

 * If there is a _Site Icon_ set in CustomizerCustomizer Tool built into WordPress
   core that hooks into most modern themes. You can use it to preview and modify
   many of your site’s appearance settings., redirect `/favicon.ico` requests to
   that icon.
 * Otherwise, use the WordPress logo as a default icon.
 * If a physical `/favicon.ico` file exists, do nothing and let the server handle
   the request.

**This logic will only work if WordPress is installed in the root directory.**

With these changes, `/favicon.ico` handling is now more consistent with `/robots.
txt` requests.

## New functions & hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same.

WordPress 5.4 introduces a bunch of new functions and hooks for favicon handling:

 * `is_favicon()` conditional tagtag A directory in Subversion. WordPress uses tags
   to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention
   of tags in version control systems. (Not to be confused with post tags.) to complement`
   [is_robots()](https://developer.wordpress.org/reference/functions/is_robots/)`.
 * `do_favicon` action to complement `[do_robots](https://developer.wordpress.org/reference/hooks/do_robots/)`
   and use it in template loader. This hook will be fired when the template loader
   determines a favicon request.
 * `do_favicon()` function, hooked to the above action by default, to complement`
   [do_robots()](https://developer.wordpress.org/reference/functions/do_robots/)`.
 * `do_faviconico` action to complement `[do_robotstxt](https://developer.wordpress.org/reference/hooks/do_robotstxt/)`,
   for plugins and themes to override the default behavior. This hook will be fired
   when displaying the favicon file.

With the above logic, `do_favicon` redirects to the _Site Icon_ if it exists, or
to WordPress logo as a default icon, using the following code:

    ```notranslate
    function do_favicon() {
        /**
         * Fires when serving the favicon.ico file.
         *
         * @since 5.4.0
         */
        do_action( 'do_faviconico' );

        wp_redirect( get_site_icon_url( 32, admin_url( 'images/w-logo-blue.png' ) ) );
        exit;
    }
    ```

Themes and plugins developers can use `do_faviconico` action to override the default
behavior.

## Deprecations

 * `wp_favicon_request()` is now deprecated in favor of `do_favicon()`.

---

For reference, see the related ticketticket Created for both bug reports and feature
development on the bug tracker. on WordPress CoreCore Core is the set of software
required to run WordPress. The Core Development Team builds WordPress. TracTrac 
An open source project by Edgewall Software that serves as a bug tracker and project
management tool for WordPress.: [#47398](https://core.trac.wordpress.org/ticket/47398)

[#5-4](https://make.wordpress.org/core/tag/5-4/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#favicon](https://make.wordpress.org/core/tag/favicon/)

 [  ](https://profiles.wordpress.org/jenmylo/) [Jen](https://profiles.wordpress.org/jenmylo/)
12:22 pm _on_ February 9, 2012     
Tags: [3.4 ( 20 )](https://make.wordpress.org/core/tag/3-4/),
favicon   

# 󠀁[If someone who’s not already on a team…](https://make.wordpress.org/core/2012/02/09/if-someone-whos-not-already-on-a-team/)󠁿

If someone who’s not already on a team wanted to take a stab at [#16434](https://core.trac.wordpress.org/ticket/16434),
that would be awesome. [@aaronjorbin](https://profiles.wordpress.org/aaronjorbin/):
what are you up to? 😉

[#3-4](https://make.wordpress.org/core/tag/3-4/), [#favicon](https://make.wordpress.org/core/tag/favicon/)