[wp-trac] [WordPress Trac] #64222: Improve the upgrade process for the Twemoji library

WordPress Trac noreply at wordpress.org
Mon Nov 10 15:48:12 UTC 2025


#64222: Improve the upgrade process for the Twemoji library
------------------------------+-----------------------------
 Reporter:  desrosj           |      Owner:  (none)
     Type:  feature request   |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:  2nd-opinion
  Focuses:  javascript        |
------------------------------+-----------------------------
 The current process for upgrading the Twemoji library is as follows:

 1. The new image assets from the Twemoji release must be uploaded to the
 wordpress.org CDN. **This must be done before any testing occurs**.
 Hitting the URL where a character is expected to be will prime the CDN's
 cache and should be viewed as having an indefinite lifespan.
   - When ''only new files/Emoji'' are added, the previous folder can be
 used. Since only the new files need to be fetched, it can help to save
 requests refetching the same asset at a new URL.
   - When old files/Emoji are modified and the modifications change the
 meaning or how the Emoji is interpreted, a new folder should be added to
 the CDN. For an example of this, see #51356 and the changes to the
 kneeling Emoji.
   - When old files/Emoji are modified and the modifications do not change
 the meaning or interpretation of the character, a new folder is not always
 necessary.
 1. Update the `src/js/_enqueues/vendor/twemoji.js` file to include the
 latest changes. There are WP specific changes in this file that must be
 preserved.
 1. The values of `baseUrl`, `svgUrl`, and `$cdn_url` variables in `src/wp-
 includes/formatting.php` and `$png_cdn`/`$svg_cdn` in
 `tests/phpunit/tests/formatting/emoji.php` should be updated to reflect
 the new paths for the `w.org` CDN locations.
 1. The Twemoji version queried in the `replace:emoji-regex` Grunt task
 found in `Gruntfile.js` should be updated to ensure the correct list of
 characters is retrieved.
 1. Run `npm run grunt precommit:emoji` to update the list of entities and
 partials in `src/wp-includes/formatting.php`.
 1. The `emoji` case within browserSupportsEmoji()` should be updated to
 test for a character in the most recently supported version of Emoji to
 ensure all characters are properly displayed.
 1. When a new flag is added or adjusted, the conditions used to the
 browser properly supports the latest version of Emoji in
 ``src/js/_enqueues/lib/emoji-loader.js` should be examined.
   - When a new letter locale flag is added, there is a check that should
 be updated to replace the previous, most recent one (currently Sark as of
 Emoji 16/[60227]).
   - There may be additional edge cases that warrant new checks. For
 example, England is a country within the United Kingdom and does not have
 a two letter locale. It's character sequence is represented by `(black
 flag emoji + [G] + [B] + [E] + [N] + [G])`.
   - The transgender flag is the `(white flag emoji + transgender symbol)`
 combined with either a ZWJ or zero-width space.
 1. The assertions performed in
 `Tests_Formatting_Emoji::test_wp_emoji_list_returns_data` are updated to
 reflect the update being applied.

 Other notes:
 - The Twemoji library was previously listed as an npm dependency. This
 changed in [55186] because of the addition of some WordPress specific code
 to ensure that Emoji replacement does not happen within any element
 containing the `wp-exclude-emoji` class.
 - Testing an update to Twemoji prior to the CDN can be done using the
 [https://wordpress.org/plugins/local-twemoji/ Local Twemoji plugin], or by
 changing the CDN paths to use the raw content URL from GitHub (ie.
 https://raw.githubusercontent.com/jdecked/twemoji/v17.0.2/assets/72x72/1f004.png
 provided the release has been tagged, or
 https://raw.githubusercontent.com/jdecked/twemoji/388f518b756404152f128a3539f5e7f9a6f1ebd6/assets/72x72/1f004.png
 using the full-length SHA value that points to the commit updating the
 library to the next version).

 Some of the steps above can and should be automated using a build task to
 help prevent mistakes when upgrading the library. For example, logic can
 be added to the `precommit:emoji` task to insert the two WordPress
 specific changes from [55186] into the final version of the file that's
 shipped in WordPress. Then, the package can be re-added as to the list of
 `dependencies` in the `package.json` file, and a new `emoji-upgrade` Grunt
 task could:
 - Update the library to the latest version (if there is one).
 - Update the version reference in the `precommit:emoji` Grunt task.
 - Perform the `precommit:emoji` Grunt task.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64222>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list