Repository navigation
Match custom emoji by shortcode - #4017
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
An unmapped shortcode can consume the opening colon of a valid emoji, preventing it from rendering in replies and author names; both replacement paths need a fix and regression coverage.
1 open issue
What changed in this PR
This PR updates custom emoji rendering in replies and author names to use shortcode lookup with a fixed matching pattern.
Changes:
- Validates shortcode names and preserves case-insensitive matching.
- Prepares only emoji used in author names and uses WordPress’s block serialization helper for replies.
- Adds regression tests and a security changelog entry.
| File | Description |
|---|---|
tests/phpunit/tests/includes/class-test-emoji.php |
Tests validation, large emoji sets, case-insensitive matching, and unused emoji handling. |
includes/class-emoji.php |
Adds shared shortcode validation and replacement, filters stored emoji, and updates block serialization. |
.github/changelog/fix-emoji-replacement |
Documents improved emoji rendering in names and replies. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #
Proposed changes:
:name:) in one pass over the text, and each one is looked up in the emoji of the post or the actor._and-, 2 to 100 characters. Emoji with other names are not stored and stay text.12:30:blobcat:stays as it is.get_comment_delimited_block_content().Other information:
Testing instructions:
:Blobcat:for:blobcat:): it still shows.npm run env-test -- --filter Test_EmojiChangelog entry
Changelog Entry Details
Significance
Type
Message