diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php
index 445de9ee29..1fe0029319 100644
--- a/src/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/src/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -2324,6 +2324,10 @@ class WP_HTML_Tag_Processor {
continue;
}
+ $tag_ends_at = strpos( $this->html, '>', $this->bytes_already_parsed );
+ $this->tag_ends_at = $tag_ends_at;
+ $this->bytes_already_parsed = $tag_ends_at;
+
return $this->html;
}