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

WordPress Trac noreply at wordpress.org
Fri Mar 31 09:18:45 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:                |     Focuses:
--------------------------+------------------------------

Comment (by ntsekouras):

 That's a tough one since what takes effect here is the combination of post
 content and post featured image, which also calls `the_post`:
 https://github.com/WordPress/gutenberg/pull/45534

 The reason is the same for both, as some places in code check if they are
 in the loop and this is bad to start with. Ideally templates/blocks
 shouldn't rely on the loop(that goes for post content) and maybe there
 could be another way to handle lazy loading of images?

 I'm not sure how we could find plugins or blocks that rely on the loop and
 start a deprecation process.. Normally using block context could make the
 trick, but I'm not sure of the nuances of every use case. Recently there
 was a related discussion here: https://github.com/woocommerce/woocommerce-
 blocks/discussions/8792.

 Backwards compatibility is tough.

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


More information about the wp-trac mailing list