[wp-trac] [WordPress Trac] #55104: is_main_query() fatal error on null

WordPress Trac noreply at wordpress.org
Fri Apr 29 09:26:14 UTC 2022


#55104: is_main_query() fatal error on null
----------------------------------------+-----------------------------
 Reporter:  nhadsall                    |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Future Release
Component:  Query                       |     Version:
 Severity:  major                       |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+-----------------------------
Changes (by johnbillion):

 * keywords:  2nd-opinion => needs-patch good-first-bug
 * milestone:  Awaiting Review => Future Release


Comment:

 It makes sense to add a guard condition for `$wp_query` to
 `is_main_query()`. All the other `is_*()` conditionals (`is_single()`,
 `is_home()`, etc) that inspect `$wp_query` have this guard condition and
 trigger a call to `_doing_it_wrong()` when `$wp_query` isn't set.

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


More information about the wp-trac mailing list