[wp-trac] [WordPress Trac] #58027: Post Content / Post Featured Image blocks break content if added before the loop

WordPress Trac noreply at wordpress.org
Tue Apr 4 17:58:39 UTC 2023


#58027: Post Content / Post Featured Image blocks break content if added before the
loop
------------------------------+------------------------------
 Reporter:  edge22            |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Editor            |     Version:  5.8
 Severity:  normal            |  Resolution:
 Keywords:  has-testing-info  |     Focuses:
------------------------------+------------------------------
Changes (by ironprogrammer):

 * keywords:   => has-testing-info


Old description:

> 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

New description:

 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-One.
 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

--

Comment:

 Updated "classic" theme referenced in reproduction step 1 to TT1 (TT2 is a
 block theme).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58027#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list