diff --git a/packages/block-library/src/post-title/edit.js b/packages/block-library/src/post-title/edit.js index 4a186276408daa..f6bba609907315 100644 --- a/packages/block-library/src/post-title/edit.js +++ b/packages/block-library/src/post-title/edit.js @@ -27,7 +27,7 @@ export default function PostTitleEdit( { context: { postType, postId, queryId }, insertBlocksAfter, } ) { - const TagName = 'h' + level; + const TagName = level === 0 ? 'p' : `h${ level }`; const isDescendentOfQueryLoop = Number.isFinite( queryId ); const userCanEdit = useSelect( ( select ) => { diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index f4a91a6891ea81..ed27f2e4158eb4 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -33,7 +33,7 @@ function render_block_core_post_title( $attributes, $content, $block ) { $tag_name = 'h2'; if ( isset( $attributes['level'] ) ) { - $tag_name = 'h' . $attributes['level']; + $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . (int) $attributes['level']; } if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {