Skip to content

Commit

Permalink
fixed the validation function: added an exception for inner blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Fellan-91 committed Mar 5, 2024
1 parent 79ef4be commit 9d9f879
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/class-rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,15 @@ public function get_block( $request ) {
* @return boolean
*/
public function is_valid_html( $html ) {
// Remove <InnerBlocks> tags using regular expression.
$cleaned_html = preg_replace( '/<InnerBlocks\s*\/?>/', '', $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();
Expand Down

0 comments on commit 9d9f879

Please sign in to comment.