[wp-trac] [WordPress Trac] #58027: Post Featured Image block breaks content if added before the loop
WordPress Trac
noreply at wordpress.org
Thu Mar 30 15:10:15 UTC 2023
#58027: Post Featured Image block breaks content if added before the loop
--------------------------+-----------------------------
Reporter: edge22 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Since 6.2, any "classic" theme that hooks the core "Post Featured Image"
block before the loop causes the content within the loop to disappear.
To replicate:
1. Use a "classic" theme like Twenty Twenty Two.
2. Hook the Post Featured Image block into the theme before the loop
begins:
{{{#!php
<?php
add_action( 'wp_body_open', function() {
$block_content = '<!-- wp:post-featured-image /-->';
$block = parse_blocks($block_content)[0];
echo render_block($block);
} );
}}}
3. View a single post.
The content will be gone.
This is an issue if any theme is allowing users to insert this block as a
page hero before the loop begins.
This is the PR that introduced the error:
https://github.com/WordPress/gutenberg/pull/45534
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58027>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list