[wp-trac] [WordPress Trac] #53824: Fatal error when in action pre_get_posts call *_template()

WordPress Trac noreply at wordpress.org
Tue Aug 3 00:45:32 UTC 2021


#53824: Fatal error when in action pre_get_posts call *_template()
--------------------------+---------------------
 Reporter:  Adiasz        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.8.1
Component:  Query         |     Version:  5.8
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------

Comment (by peterwilsoncc):

 Adding some thoughts I've had overnight:

 * Within `get_query_template()`, `locate_block_template()` should probably
 check for theme support. If nothing else, it saves on a database query.
 * Half thought: A part of me is wondering if `pre_get_posts` should be
 running for templates, it seems a different purpose so might be better
 name `pre_get_templates` (backcompat break)
 * I'm a little nervous about not always running `pre_get_posts` as this is
 where plugins remove potentially damaging data
 ([https://github.com/easydigitaldownloads/easy-digital-
 downloads/blob/f97f4f6f5454921a2014dc1fa8f4caa5f550108c/includes/query-
 filters.php#L58-L87 EDD for example])

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


More information about the wp-trac mailing list