[wp-trac] [WordPress Trac] #58154: Block theme singular templates do not enter main query loop

WordPress Trac noreply at wordpress.org
Fri Sep 1 17:30:17 UTC 2023


#58154: Block theme singular templates do not enter main query loop
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Editor                               |     Version:  6.1
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-testing-info has-      |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by flixos90):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56507" 56507]:
 {{{
 #!CommitTicketReference repository="" revision="56507"
 Editor: Ensure main query loop is entered for singular content in block
 themes.

 Block themes currently lack the means to trigger the main query loop for
 singular content, since they cannot reasonably use the `core/query` and
 `core/post-template` blocks which are intended only for displaying a list
 of posts. So far, the missing main query loop on singular block templates
 has been worked around by enforcing the loop in certain `core/post-*`
 blocks, which however causes other bugs.

 This changeset ensures that the main query loop is still started for
 singular block theme templates, by wrapping the entire template into the
 loop, which will by definition only have a single cycle as it only
 encompasses a single post. This is currently the most reliable solution,
 since even if there were blocks to properly trigger the main query loop on
 singular content, it would be unrealistic to expect all existing block
 themes to update their templates accordingly. It may be revisited in the
 future.

 Props gziolo, youknowriad, joemcgill, costdev, mukesh27, flixos90.
 Fixes #58154.
 See #59225, #58027.
 }}}

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


More information about the wp-trac mailing list