Themes: Add support for Update URI
header.
This allows third-party themes to avoid accidentally being overwritten with an update of a theme of a similar name from the WordPress.org Theme Directory.
Additionally, introduce the update_themes_{$hostname}
filter, which third-party themes can use to offer updates for a given hostname.
If set, the Update URI
header field should be a URI and have a unique hostname.
Some examples include:
https://wordpress.org/themes/example-theme/
https://example.com/my-theme/
my-custom-theme-name
Update URI: false
also works, and unless there is code handling the false
hostname, the theme will never get an update notification.
If the header is present, the WordPress.org API will currently only return updates for the theme if it matches the following format:
https://wordpress.org/themes/{$slug}/
w.org/theme/{$slug}
If the header has any other value, the API will not return a result and will ignore the theme for update purposes.
Follow-up to [50921].
Props dd32, meloniq, costdev, audrasjb, DavidAnderson, markjaquith, DrewAPicture, mweichert, design_dolphin, filosofo, sean212, nhuja, JeroenReumkens, infolu, dingdang, joyously, earnjam, williampatton, grapplerulrich, markparnell, apedog, afragen, miqrogroove, rmccue, crazycoders, jdgrimes, damonganto, joostdevalk, jorbin, georgestephanis, khromov, GeekStreetWP, jb510, Rarst, juliobox, Ipstenu, mikejolley, Otto42, gMagicScott, TJNowell, GaryJ, knutsp, mordauk, nvartolomei, aspexi, chriscct7, benoitchantre, ryno267, lev0, gregorlove, dougwollison, leemon, SergeyBiryukov.
See #14179, #23318, #32101.