diff --git a/wp-includes/html-api/class-wp-html-tag-processor.php b/wp-includes/html-api/class-wp-html-tag-processor.php
index fcf418e856..0ff2cdc4dd 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -614,7 +614,7 @@ class WP_HTML_Tag_Processor {
*
* @since 6.5.0
*
- * @var string
+ * @var int
*/
private $text_length;
@@ -2894,11 +2894,13 @@ class WP_HTML_Tag_Processor {
* @return string
*/
public function get_modifiable_text(): string {
- if ( null === $this->text_starts_at || 0 === $this->text_length ) {
+ $has_enqueued_update = isset( $this->lexical_updates['modifiable text'] );
+
+ if ( ! $has_enqueued_update && ( null === $this->text_starts_at || 0 === $this->text_length ) ) {
return '';
}
- $text = isset( $this->lexical_updates['modifiable text'] )
+ $text = $has_enqueued_update
? $this->lexical_updates['modifiable text']->text
: substr( $this->html, $this->text_starts_at, $this->text_length );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 62c0b10642..f4d8950bd7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.7-alpha-58865';
+$wp_version = '6.7-alpha-58866';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.