[wp-trac] [WordPress Trac] #55745: FSE post-content block is using wrong "first" item in the query loop

WordPress Trac noreply at wordpress.org
Mon May 16 16:00:43 UTC 2022

#55745: FSE post-content block is using wrong "first" item in the query loop
 Reporter:  Trekky        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  5.9.3
 Severity:  normal        |   Keywords:
  Focuses:                |

 I've created a block based theme for a Full-Site-Editing experience and
 noticed the following problem:

 I would like to show only posts from a specific category on the frontpage
 and created a template with the following content (simplified):

 <!-- wp:template-part {"slug":"header","tagName":"header","className
 ":"site-header"} /-->
 <!-- wp:group {"tagName":"main","layout":{"inherit":true}} -->
 <main class="wp-block-group">
         <!-- wp:query
         <div class="wp-block-query">
                 <!-- wp:post-template -->
                         <!-- wp:post-title {"isLink":true} /-->
                         <!-- wp:post-content /-->
                 <!-- /wp:post-template -->
         <!-- /wp:query -->
 <!-- /wp:group -->
 <!-- wp:template-part {"slug":"footer","tagName":"footer","className
 ":"site-footer"} /-->

 When using the block "post-content" the wrong post content is shown. When
 using post-excerpt the correct excerpt is used.
 Apparently the problem lies in the post-content.php file
 /wp-includes/blocks/post-content.php#L42) where

 is called.
 When this call is removed everything is working as expected. It seems this
 workaround for "third-party plugins" doesn't handle all edge cases.
 In this case the latest post on the whole site is saved as the_post()
 instead of the latest post of the query.

 I hope someone gets a solution for the problem.

 Thank you very much!

Ticket URL: <https://core.trac.wordpress.org/ticket/55745>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list