WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 7 weeks ago

#46135 new enhancement

Add filter to disable wp_favicon_request

Reported by: shawfactor Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.0.3
Component: Customize Keywords: needs-patch good-first-bug reporter-feedback
Focuses: Cc:

Description

A number of other functions in wp-includes/load.php have fikters that enable them to be disabled. However wp_favicon_request does not.

Disabling this function via a pluginn could be useful, especially in a multisite environment where you wanted to dynamicly serve a favicon in the root directory or even run a redirect.

Attachments (1)

43135.diff (721 bytes) - added by sebastienserre 7 weeks ago.

Download all attachments as: .zip

Change History (7)

#1 @shawfactor
3 months ago

I am unfamiliar with the contribution process, the fix/enhancement on this is trivial but I'd love to write to and get started co tributing to core.

Last edited 3 months ago by shawfactor (previous) (diff)

#2 @johnbillion
3 months ago

  • Focuses accessibility multisite removed
  • Keywords needs-patch good-first-bug reporter-feedback added

Thanks for the ticket, @shawfactor ! Welcome to WordPress Trac.

Out of interest, is there a particular reason you want or need to disable this handling? It always helps to know the background behind requests, as it helps gauge priority and effect.

The Core Contributor Handbook is a good place to get started with contributing to WordPress: https://make.wordpress.org/core/handbook/. There are links there to some tutorials and guides that should help to get you started. Don't forget to join our Slack too: https://chat.wordpress.org/ .

Last edited 3 months ago by johnbillion (previous) (diff)

#3 @shawfactor
3 months ago

Yes as I outlined on multisite you may want different favicons per site. You can of course do this when html is returned via a meta tag but on non html requests many browsers still look for a favicon.ico at the root of the domain.

On multisite i would like to write a plugin to either generate the favicon dynamicly or redirect the request (differently depending on the site). Currently this is impossible due to the lack of a filter.

Most other functions in load.php have filters to disable them, but this function does not.

#4 @SergeyBiryukov
2 months ago

  • Component changed from General to Customize

#5 follow-up: @andraganescu
2 months ago

Welcome @shawfactor, how do you imagine this would be more useful:

  • simply applying a filter to disable the function
  • applying a filter to set a specific header, other than the default then exit OR doing nothing if the filter returns false

@sebastienserre
7 weeks ago

#6 in reply to: ↑ 5 @shawfactor
7 weeks ago

I think simply a filter to disable IE prevent the function doing anything would be best for two reasons:

  1. It would be consistent with other functions in the same file
  1. Any handling of the url could be then left to a plugin or theme using later hooks.

Replying to andraganescu:

Welcome @shawfactor, how do you imagine this would be more useful:

  • simply applying a filter to disable the function
  • applying a filter to set a specific header, other than the default then exit OR doing nothing if the filter returns false
Note: See TracTickets for help on using tickets.