[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
Thu Aug 4 11:58:07 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.1
Component:  Query                    |     Version:  6.0
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------

Comment (by lumpysimon):

 I've worked around it by removing the call to `get_current_screen()` and
 replacing it with my own function which is exactly the same:


 {{{
 global $current_screen;

 if ( ! isset( $current_screen ) ) {
     return null;
 }

 return $current_screen;
 }}}

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


More information about the wp-trac mailing list