From 65c3a8e197f135d9db938f8d230833565618c558 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Tue, 12 Aug 2025 15:24:26 -0500 Subject: [PATCH] HTML API: Make `WP_HTML_Processor::serialize_token()` public. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trac ticket: Core-63823 Follows #7331 The `serialize_token()` method was added in WordPress 6.7.0 as a protected member on the `WP_HTML_Processor` class. It wasn’t clear at the time of merging if it would be necessary to expose it as a public method. However, since that time a number of experiments have led to the conclusion that it would be very valuable to do so. This patch opens up the method for invocation from the outside, trivializing the generation of normative HTML subspans from a parent document. Follow-up to [[59076]](https://core.trac.wordpress.org/changeset/59076). --- src/wp-includes/html-api/class-wp-html-processor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/html-api/class-wp-html-processor.php b/src/wp-includes/html-api/class-wp-html-processor.php index ba03ff44d7e53..67bccab7b35c6 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -1304,10 +1304,11 @@ public function serialize(): ?string { * @see static::serialize() * * @since 6.7.0 + * @since 6.9.0 Converted from protected to public method. * * @return string Serialization of token, or empty string if no serialization exists. */ - protected function serialize_token(): string { + public function serialize_token(): string { $html = ''; $token_type = $this->get_token_type();