Issue with get_current_screen() ? | WordPress.org

[ad_1]

I’m getting critical errors on some sites and Modula seems to be the single point of refererence in each case. I’ve pasted the error below – chatgpt seems to think that it’s to do with calling get_current_screen() on front end and suggests this:

// In class-modula.php around line 389
if (is_admin()) {
$screen = get_current_screen();
// Ensure $screen is available before using it
if ($screen) {
// Your existing code that uses $screen
}
}

FYI – 2 plugins that I had conflict with, Beaver Builder in edit mode… And SEO Press

[Tue Jul 30 12:37:22.747867 2024] [proxy_fcgi:error] [pid 2511180:tid 2511281] [client 172.70.85.189:0] AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /home/simplyhen/webapps/app-simplyhen2022/wp-content/plugins/modula-best-grid-gallery/includes/class-modula.php:389\nStack trace:\n#0 /home/simplyhen/webapps/app-simplyhen2022/wp-includes/class-wp-hook.php(324): Modula->modula_enqueue_media()\n#1 /home/simplyhen/webapps/app-simplyhen2022/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n#2 /home/simplyhen/webapps/app-simplyhen2022/wp-includes/plugin.php(517): WP_Hook->do_action()\n#3 /home/simplyhen/webapps/app-simplyhen2022/wp-includes/media.php(4960): do_action()\n#4 /home/simplyhen/webapps/app-simplyhen2022/wp-content/plugins/wp-seopress/src/Actions/Admin/ModuleMetabox.php(69): wp_enqueue_media()\n#5 /home/simplyhen/webapps/app-simplyhen2022/wp-content/plugins/wp-seopress/src/Actions/Admin/ModuleMetabox.php(170): SEOPress\Actions\Admin\ModuleMetabox->enqueueModule()\n#6 /home/simplyhen/webapps/app-simplyhen2022/wp-includes/class-wp-hook.php(324…’, referer: https://simplyhen.co.uk/wp-admin/post.php?post=1148&action=edit&classic-editor

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer