PHP Fatal error: Call to undefined function get_current_screen
-
The previous version and the new one generate a fatal error when visiting the admin url from within private browsing:
https://www.domain.com/wp-admin
An error page is presented in the frontend and the
debug.log
says:[22-Mar-2022 10:08:41 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen() in \wp-includes\script-loader.php:2356 Stack trace: #0 \wp-includes\class-wp-hook.php(307): wp_global_styles_render_svg_filters('') #1 \wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #2 \wp-includes\plugin.php(474): WP_Hook->do_action(Array) #3 \wp-includes\general-template.php(3074): do_action('wp_body_open') #4 \wp-content\themes\flatsome\header.php(16): wp_body_open() #5 \wp-includes\template.php(770): require_once('D:\\domains\\www....') #6 \wp-includes\template.php(716): load_template('D:\\domains\\www....', true, Array) #7 \wp-includes\general-template.php(48): locate_template(Array, true, true, Array) #8 \wp-content\themes\flatsome\404.php(10): get_header() #9 \wp-includes\template.php(772): require('D:\\domains\\www....') #10 \wp-includes\template.php(716): load_template('D:\\domains\\www....', false, Array) #11 \wp-includes\general-template.php(204): locate_template(Array, true, false, Array) #12 \wp-content\plugins\hide-login-page\libs\factory\templates\includes\class-helpers.php(79): get_template_part(404) #13 \wp-content\plugins\hide-login-page\includes\classes\class.configurate-hide-login-page.php(226): WBCR\Factory_Templates_106\Helpers::setError404() #14 \wp-content\plugins\hide-login-page\includes\classes\class.configurate-hide-login-page.php(153): WHLP_ConfigHideLoginPage->setAccessError() #15 \wp-includes\class-wp-hook.php(307): WHLP_ConfigHideLoginPage->wpLoaded('') #16 \wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #17 \wp-includes\plugin.php(474): WP_Hook->do_action(Array) #18 \wp-settings.php(609): do_action('wp_loaded') #19 \wp-config.php(144): require_once('D:\\domains\\www....') #20 \wp-load.php(50): require_once('D:\\domains\\www....') #21 \wp-admin\admin.php(34): require_once('D:\\domains\\www....') #22 \wp-admin\index.php(10): require_once('D:\\domains\\www....')
The workaround that’s working for me is:
\plugins\hide-login-page\libs\factory\templates\includes\class-helpers.php
line ~77if( $wp_query && is_object($wp_query) ) { $wp_query->set_404(); #alx359--> #get_template_part(404); header('Location: /'); die(); #<--alx359 } else { global $pagenow;
HTH.
Thanks.
- The topic ‘PHP Fatal error: Call to undefined function get_current_screen’ is closed to new replies.