From 9d9f8798f77bd49bf2fd31838bc2d1ec67869ad6 Mon Sep 17 00:00:00 2001 From: Fellan-91 Date: Tue, 5 Mar 2024 13:55:27 +0300 Subject: [PATCH] fixed the validation function: added an exception for inner blocks --- classes/class-rest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/class-rest.php b/classes/class-rest.php index bb87a0cc..dd0b157a 100644 --- a/classes/class-rest.php +++ b/classes/class-rest.php @@ -256,12 +256,15 @@ public function get_block( $request ) { * @return boolean */ public function is_valid_html( $html ) { + // Remove tags using regular expression. + $cleaned_html = preg_replace( '//', '', $html ); + $dom = new DOMDocument(); // Disable libxml errors and error handling. libxml_use_internal_errors( true ); - $dom->loadHTML( $html ); + $dom->loadHTML( $cleaned_html ); // Get any errors from libxml. $errors = libxml_get_errors();