Support » Plugin: Prismatic » Getting “Uncaught Error: Call to undefined function get_current_screen()”

  • Resolved Deepak

    (@golinuxcloud)


    Hello,

    I have been getting this message from WordPress

    Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

    In this case, WordPress caught an error with one of your plugins, Prismatic.

    I enabled debug log and following the trace output:

    [14-Jul-2022 03:29:49 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'iks_menu_fs_uninstall_cleanup' not found or invalid function name in /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php on line 307
    [14-Jul-2022 11:38:47 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 11:51:47 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 11:52:37 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 11:52:44 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:14:41 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [14-Jul-2022 16:15:06 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [14-Jul-2022 16:19:26 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:33 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:38 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:42 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:48 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:53 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:19:59 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:20:09 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:20:31 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:21:11 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:21:18 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 16:22:44 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 18:58:58 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 18:59:18 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 18:59:34 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:00:25 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:01:04 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:01:11 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:01:39 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:01:45 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:04:42 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [14-Jul-2022 19:29:19 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [14-Jul-2022 19:29:41 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [14-Jul-2022 19:31:21 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:31:55 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 19:32:03 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 20:40:55 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:05:04 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:10:49 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:13:22 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:15:04 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:15:56 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [14-Jul-2022 21:48:17 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 04:11:19 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 04:11:31 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:23:50 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13
    [15-Jul-2022 06:24:57 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:25:00 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:37:48 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:37:53 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:41:12 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:41:16 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
    [15-Jul-2022 06:41:24 UTC] PHP Notice:  Undefined index: active in /home/ivrj9qv/public_html/wp-content/plugins/members/admin/class-notifications.php on line 414
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Glad to help. I’m not seeing any error on default WordPress. Can you tell me the basic steps to repeat the error? That would make it possible to investigate and resolve any issue asap. Thank you.

    Thread Starter Deepak

    (@golinuxcloud)

    Thanks for looking into this.

    Unfortunately I don’t know how/why it happens. I just get these mails every now and then. As you can see from past couple of days I started receiving this mail for Prismatic
    Image Screenshot

    The very first mail started from

    WordPress version 5.9.3
    Current theme: GeneratePress Child (version 0.3)
    Current plugin: Prismatic (version 3.1.1)
    PHP version 7.4.30

    Yesterday again I got this event

    [15-Jul-2022 10:39:45 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php:13
    Stack trace:
    #0 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): prismatic_enqueue('')
    #1 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /home/ivrj9qv/public_html/wp-includes/script-loader.php(2156): do_action('wp_enqueue_scri...')
    #4 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(307): wp_enqueue_scripts('')
    #5 /home/ivrj9qv/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #6 /home/ivrj9qv/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #7 /home/ivrj9qv/public_html/wp-includes/general-template.php(3042): do_action('wp_head')
    #8 /home/ivrj9qv/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    #9 /home/ivrj9qv/public_html/wp-includes in /home/ivrj9qv/public_html/wp-content/plugins/prismatic/inc/resources-enqueue.php on line 13

    Regarding my environment
    I don’t use the CSS provided by prismatic, instead I preload my own CSS file to avoid render blocking.

    wp_dequeue_style( 'prismatic-highlight' );		
    wp_dequeue_style( 'prismatic-blocks' );

    I hope these can help

    • This reply was modified 4 months, 2 weeks ago by Deepak.
    Plugin Author Jeff Starr

    (@specialk)

    Thanks. So here is the actual reported error:

    Call to undefined function get_current_screen()

    get_current_screen() is a core WordPress function, which means it exists in all WordPress installations. So it’s weird that it’s “not available” on your site. It suggests something misconfigured or some other issue on your site. Because again, get_current_screen() is a core WordPress function, and thus always should exist.

    • This reply was modified 4 months, 2 weeks ago by Jeff Starr.
    Thread Starter Deepak

    (@golinuxcloud)

    I can see many people have reported similar problems (although with different plugins)

    and a possible solution was added
    https://wordpress.org/support/topic/call-to-undefined-function-get_current_screen-6/

    Is it possible to have something similar in prismatic?

    Plugin Author Jeff Starr

    (@specialk)

    It may be possible, but in order to implement I need the steps to replicate the error on default WordPress site. Otherwise, there is no way to know if the suggested technique actually will resolve the issue.

    Thread Starter Deepak

    (@golinuxcloud)

    Hi,

    Yesterday due to some incident I had to perform a restore operation using updraftplus and the restore continued to fail with the same error as I reported here for Prismatic. The restore went through only after deactivating prismatic.

    Also this error was seen daily around the same time when backup was triggered using updraftplus plugin.

    I hope this helps to reproduce the issue and fix the same.

    Regards

    Plugin Author Jeff Starr

    (@specialk)

    Thanks I will try to repeat the issue and resolve any issue. Feel free to post again with any further information, clues, etc. Glad to help anytime.

    Thread Starter Deepak

    (@golinuxcloud)

    Just an update

    I added this in your plugin/inc/resources-enqueue.php and since then I have not received any uncaught errors any more. It have been more than a month now.

    if (is_admin()) {
    
    		if ( !function_exists( 'get_current_screen' ) ) { 
      			require_once ABSPATH . '/wp-admin/includes/screen.php'; 
    		} 
    		
    		$screen = get_current_screen();
    Plugin Author Jeff Starr

    (@specialk)

    Thanks I will take a look and add if everything tests/looks good.

    Plugin Author Jeff Starr

    (@specialk)

    Just to follow up, this is implemented in the next version of the plugin (3.2). Thanks again, @golinuxcloud.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.