Key details

  1. Primary developer progress report: October 7, 2026.
  2. Core Trac ticket #66208; upstream implementation PR #13271.
  3. wp_kses() public interface unchanged, internal parsing and output serialisation replaced.
  4. Character references, tag case, attribute quoting and malformed fragments may produce different strings.
  5. Disallowed script/style content is removed along with its tags, unlike some legacy behaviour.
  6. Temporary wp_kses_force_legacy_parser opt-out is documented but not guaranteed long term.
  7. 7.2 versus 7.3 inclusion is not yet final.

What builders should take away

  1. Test plugins/themes that filter or compare wp_kses() output, especially imports, HTML transforms and snapshot assertions.
  2. Include malformed HTML, unescaped ampersands, scripts/styles, inline SVG/MathML and truncated fragments in compatibility tests.
  3. Avoid depending on exact raw sanitised markup where semantic equivalence is sufficient.
  4. Use the legacy filter only as a temporary diagnostic while reporting regressions upstream.
  5. Treat 7.2 release inclusion as conditional until beta and release-candidate confirmation.

What changed

WordPress core contributor Dennis Snell's October 7 progress report details an HTML API-based reimplementation of wp_kses(), the longstanding HTML filtering and sanitisation function used by WordPress and its plugin ecosystem. Instead of manipulating HTML-like strings through regex and legacy token handling, the replacement structurally parses input and serialises allowed output. The public wp_kses() interface stays the same, but it can lowercase tags, normalise attributes and character references, remove disallowed script/style elements together with their contents, and discard ambiguous truncated input. A temporary wp_kses_force_legacy_parser filter allows opting back into legacy behaviour while compatibility testing continues. The change is in trunk; whether it lands in WordPress 7.2 or slips to 7.3 remains contingent on testing.

Why it matters

Plugins, themes and publishing integrations routinely pass user-provided markup through wp_kses(). An unchanged PHP function signature does not guarantee unchanged output bytes. Content filters, snapshots, sanitiser unit tests and workflows that inspect sanitised markup can behave differently even where the resulting output is safe. Structural parsing also targets longstanding mismatch risks between server-side filtering and browsers' HTML parsing. For the WordPress plugin ecosystem, that is a meaningful compatibility and security-hardening migration rather than a cosmetic refactor.

Normalisation changes observable HTML

The replacement serialises parsed markup consistently: tag names can become lowercase, attributes double-quoted and entities decoded then re-escaped. Developers comparing raw HTML strings or expecting legacy malformed-markup repairs should test with representative content, not only valid HTML.

Disallowed script and style contents now disappear

Under the old default post-context filter, stripping a disallowed script element could leave its text content visible; the new parser removes both element and contents. Incomplete tags at the end of input can be dropped rather than rendered as escaped text. These differences can affect saved content previews, import pipelines and plugin tests without indicating a new vulnerability.

A temporary compatibility switch exists

The core progress report documents add_filter('wp_kses_force_legacy_parser','__return_true') to select the old implementation temporarily. Maintainers warn the old path can disappear in a future release or even before WordPress 7.2 final, so this should be a diagnostic fallback, not a permanent compatibility strategy.

Trunk is not a guaranteed shipping release

WordPress Trac ticket #66208 and the upstream pull request track implementation and tests. The current branch milestone and third-party coverage point toward 7.2, but final inclusion is still under consideration. Test against a current development build and recheck beta/RC notes before making release-specific assertions.

What to watch next

  • Final merge and WordPress 7.2 beta/RC decision for Trac #66208.
  • Behavioural test failures and downstream plugin/theme regressions.
  • Whether the temporary legacy-parser filter is retained for a transition period.
  • Measured security and performance results on representative real-world content.

Still unclear

  • The exact release version is not locked.
  • Compatibility impact varies with how each plugin handles sanitised output.
  • The developer describes performance and safety improvements but independent cross-plugin performance data is not yet established.

Sources

Direct reading behind this dossier.

3 sources
Progress Report: wp_kses()
Make WordPress Core primary

Developer's exact output examples, opt-out filter and release uncertainty.

Within WordPress ecosystem roundup
Within WordPress independent

Independent plugin/theme developer compatibility context; not independent performance validation.

Discussion

Discussion is reader-contributed. Comments are not part of the BTN dossier or its editorial evidence.

0 visible comments

Join the discussion

Keep comments useful and relevant. Reader contributions may be moderated and are not BTN editorial evidence.

Sign in to comment