Skip to content

Commit 5a0811f

Browse files
Improve readability of logic operators
Co-authored-by: Alec Geatches <alec.geatches@automattic.com>
1 parent 65418c5 commit 5a0811f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/parser/content-parser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public function parse( $post_content, $post_id = null, $filter_options = [] ) {
149149
// An empty `post_content` fails `has_blocks` check, but is still valid.
150150
$content_is_empty = empty( trim( $post_content ) );
151151

152-
if ( ! ( $content_is_empty || has_blocks( $post_content ) ) ) {
152+
$has_content = ! empty( trim( $post_content ) );
153+
154+
if ( $has_content && ! has_blocks( $post_content ) ) {
153155
$error_message = join(' ', [
154156
sprintf( 'Error parsing post ID %d: This post does not appear to contain block content.', $post_id ),
155157
'The VIP Block Data API is designed to parse Gutenberg blocks and can not read classic editor content.',

0 commit comments

Comments
 (0)