Skip to content

KSES: Reimplement with Tag Processor - #13271

Open
dmsnell wants to merge 17 commits into
WordPress:trunkfrom
dmsnell:kses/dual-with-tag-processor
Open

KSES: Reimplement with Tag Processor#13271
dmsnell wants to merge 17 commits into
WordPress:trunkfrom
dmsnell:kses/dual-with-tag-processor

Conversation

@dmsnell

@dmsnell dmsnell commented Aug 25, 2026

Copy link
Copy Markdown
Member

Trac ticket: Core-65984

Merge after #13273, which accounts for three of the failing tests.

  • self-closing non-HTML elements
  • [~] remove opening tag when required attributes are missing, and closing tag
    • while this would be a nice enhancement it’s going to be left out of this work to preserve existing behaviors. with the HTML Processor powering wp_kses(), it’s possible to simply wait until an opened element is closed based on depth, and skip that closing element if it exists.
  • replace C0 controls with their escapes, rather than stripping them away
  • [~] handle incomplete parsing, including closing all open elements
    • plenty of existing code in Core calls wp_kses() with intentionally-incomplete input, for example, a wrapper opening tag with part of the content, separately from the closer. closing open elements does a good job of isolating content, but legacy behaviors depend too much on the more procedural use of wp_kses() so isolation cannot be reasonably added without mangling websites.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch 22 times, most recently from c784058 to fdc5e96 Compare August 27, 2026 17:00
@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch 5 times, most recently from bd15b3e to 38470b2 Compare August 28, 2026 04:31
@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch 6 times, most recently from 43c8868 to 54ea7dd Compare August 29, 2026 20:35
@dmsnell
dmsnell marked this pull request as ready for review August 29, 2026 20:40
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props dmsnell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch 2 times, most recently from 37425f9 to 59b9aa1 Compare August 29, 2026 20:47
@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch 2 times, most recently from f4a9c35 to 3ea625d Compare August 29, 2026 22:19
@dmsnell
dmsnell force-pushed the kses/dual-with-tag-processor branch from 3ea625d to bdbae3a Compare August 29, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant