[wp-trac] [WordPress Trac] #59736: Regression: Singular block template

WordPress Trac noreply at wordpress.org
Fri Oct 27 14:05:46 UTC 2023


#59736: Regression: Singular block template
--------------------------------------+-----------------------
 Reporter:  afragen                   |       Owner:  flixos90
     Type:  defect (bug)              |      Status:  assigned
 Priority:  high                      |   Milestone:  6.4
Component:  Query                     |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------

Comment (by hellofromTonya):

 A colleague alerted me to an issue in WooCommerce Blocks that seems
 related to this issue.

 >In the render code for this block we just loop through `have_posts()` and
 then output the template part. You can see the
 [https://github.com/woocommerce/woocommerce-
 blocks/blob/1dbf1ff28f88254802f28e4b1a13e1e72dfb28b5/src/BlockTypes/ClassicTemplate.php#L176
 very simple code here].
 >
 >It seems that, in 6.4, however, `have_posts()` is `false`, and so we
 don’t get into the while loop. This is a bit odd, as if I inspect global
 `$wp_query` I can see it correctly. And, even calling
 `$wp_query->have_posts()` resets the loop and makes it work correctly.

 In testing [https://github.com/WordPress/wordpress-develop/pull/5575 PR
 5575], confirmed the patch resolves the issue.

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


More information about the wp-trac mailing list