[wp-trac] [WordPress Trac] #55917: Fatal error in WP6.0 when calling get_current_screen on the pre_get_posts action

WordPress Trac noreply at wordpress.org
Tue Jul 5 18:52:00 UTC 2022


#55917: Fatal error in WP6.0 when calling get_current_screen on the pre_get_posts
action
-------------------------------------+---------------------
 Reporter:  lumpysimon               |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.0.1
Component:  Query                    |     Version:  6.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-testing dev-feedback => has-patch needs-testing
 * milestone:  6.0.2 => 6.0.1


Comment:

 Replying to [comment:5 azouamauriac]:
 > Therefore the bug is occurring because the hook  `wp_loaded` triggers
 `pre_get_posts` earlier, before `get_current_screen()` is available... I'm
 wondering if we can change `wp_loaded` by another without breaking
 anything.

 I remembered that we did explore moving `$fn_register_webfonts` to
 `wp_enqueue_scripts` in #55632, but it was not required for that
 particular issue. See the discussion in comment:7:ticket:55632 and on
 [https://github.com/WordPress/wordpress-
 develop/pull/2638#discussion_r861405757 PR #2638].

 [attachment:55917.diff] resolves the issue in my testing. Moving back for
 6.0.1 consideration.

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


More information about the wp-trac mailing list