diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 7b21d225ea1..f33df0990e2 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -2472,7 +2472,7 @@ private function remove_disallowed_siblings( DOMElement $node, $spec_name ) { $prev_sibling = $node->previousSibling; while ( null !== $prev_sibling ) { - if ( ! ( $prev_sibling instanceof Element ) ) { + if ( $prev_sibling instanceof Element ) { $this->remove_invalid_child( $prev_sibling, [ @@ -2487,7 +2487,7 @@ private function remove_disallowed_siblings( DOMElement $node, $spec_name ) { $next_sibling = $node->nextSibling; while ( null !== $next_sibling ) { - if ( ! ( $next_sibling instanceof Element ) ) { + if ( $next_sibling instanceof Element ) { $this->remove_invalid_child( $next_sibling, [