Make WordPress Core

08/23/2022 05:46:46 PM (21 months ago)

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 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:

  • 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 API will currently only return updates for the theme if it matches the following format:


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.

1 edited


  • trunk/src/wp-includes/class-wp-theme.php

    r53700 r53933  
    2424     * @since 3.4.0
    2525     * @since 5.4.0 Added `Requires at least` and `Requires PHP` headers.
     26     * @since 6.1.0 Added `Update URI` header.
    2627     * @var string[]
    2728     */
    4041        'RequiresWP'  => 'Requires at least',
    4142        'RequiresPHP' => 'Requires PHP',
     43        'UpdateURI'   => 'Update URI',
    4244    );
    845847     * @since 3.4.0
    846848     * @since 5.4.0 Added support for `Requires at least` and `Requires PHP` headers.
     849     * @since 6.1.0 Added support for `Update URI` header.
    847850     *
    848851     * @param string $header Theme header. Accepts 'Name', 'Description', 'Author', 'Version',
    849      *                       'ThemeURI', 'AuthorURI', 'Status', 'Tags', 'RequiresWP', 'RequiresPHP'.
     852     *                       'ThemeURI', 'AuthorURI', 'Status', 'Tags', 'RequiresWP', 'RequiresPHP',
     853     *                       'UpdateURI'.
    850854     * @param string $value  Value to sanitize.
    851855     * @return string|array An array for Tags header, string otherwise.
    897901            case 'RequiresWP':
    898902            case 'RequiresPHP':
     903            case 'UpdateURI':
    899904                $value = strip_tags( $value );
    900905                break;
Note: See TracChangeset for help on using the changeset viewer.