• Resolved ezweb

    (@ezweb)


    Uncaught Error: Call to undefined function get_current_screen()
    wp-content/plugins/instant-images/instant-images.php:180

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter ezweb

    (@ezweb)

    This causes a fatal error on the frontend. I added an is_admin check to fix it.

    Plugin Author Darren Cooney

    (@dcooney)

    Thanks @ezweb . Can you share the code?

    $screen = is_admin() ? get_current_screen()->base : '';

    Are you getting this error in a frontend page builder?

    Thread Starter ezweb

    (@ezweb)

    I use beaver builder so maybe that’s part of it not sure. But that’s not when trying to edit the site. It’s just viewing a page on the front end. It completely breaks the site.

    I just wrapped everything in the instant_img_wp_media_enqueue function in a “if ( is_admin() ) {” so none of it runs if it’s not in the admin area. Not sure that’s the correct fix. But the site works.

    Thread Starter ezweb

    (@ezweb)

    It could be caused by front end ACF forms. We use them on all sites. And I’ve got a bit of a mess. I’m updating all sites with my “fix” now.

    Plugin Author Darren Cooney

    (@dcooney)

    Yea maybe, just releasing a hotfix now (5.2.0.1).

    In my testing it would only fatal error if the user was logged in. Still not great, but some positive news.

    Thread Starter ezweb

    (@ezweb)

    New version seems great. Thank you!

    I’m getting this exact error still. It’s occurring on the Elementor front-end page-builder – more specifically, the Theme Builder page

    Plugin Author Darren Cooney

    (@dcooney)

    I can’t replicate the error in Elementor running Instant Images 5.2.0.1 and Elementor Pro 3.11.7

    I get the same error with Elementor too. Hopefully this helps:

    Error Details
    =============
    An error of type E_ERROR was caused in line 180 of the file /container/application/public/wp-content/plugins/instant-images/instant-images.php. Error message: Uncaught Error: Call to undefined function get_current_screen() in /container/application/public/wp-content/plugins/instant-images/instant-images.php:180
    Stack trace:
    #0 /container/application/public/wp-includes/class-wp-hook.php(308): InstantImages->instant_img_wp_media_enqueue('')
    #1 /container/application/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
    #2 /container/application/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #3 /container/application/public/wp-includes/media.php(4747): do_action('wp_enqueue_medi...')
    #4 /container/application/public/wp-content/plugins/elementor/app/modules/onboarding/module.php(460): wp_enqueue_media()
    #5 /container/application/public/wp-includes/class-wp-hook.php(308): Elementor\App\Modules\Onboarding\Module->Elementor\App\Modules\Onboarding\{closure}('')
    #6 /container/application/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
    #7 /container/application/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #8 /container/application/public/wp-content/plugins/elementor/includes/plugin.php(652): do_action('elementor/init')
    #9 /container/application/public/wp-includes/class-wp-hook.php(308): Elementor\Plugin->init('')
    #10 /container/application/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
    #11 /container/application/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #12 /container/application/public/wp-settings.php(617): do_action('init')
    #13 /container/application/public/wp-config.php(97): require_once('/container/appl...')
    #14 /container/application/public/wp-load.php(50): require_once('/container/appl...')
    #15 /container/application/public/wp-admin/admin.php(34): require_once('/container/appl...')
    #16 {main}
      thrown
    Plugin Author Darren Cooney

    (@dcooney)

    What versions of Instant Images, Elementor, and Elementor Pro.

    • Is this on a standard front-end editor screen when using the Image module (screenshot)?
    • Are there fatal errors on frontend or is this in the debug logs?

    Instant Images 5.2.0.1, Elementor 3.11.5 and Elementor Pro 3.11.7.

    PHP version 8.0.28 if that helps.

    Is this on a standard front-end editor screen when using the Image module? – I wasn’t accessing Instant Images as per your screenshot. I edited some text on the page in Elementor, updated the page, and then received the Your Site is Experiencing a Technical Issue email.

    Are there fatal errors on frontend or is this in the debug logs? – For this particular site I didn’t have a visual fatal error and could still edit the page. But on another site I’ve had it where I had the white screen of death on the front end.

    Plugin Author Darren Cooney

    (@dcooney)

    I’m running the exact same setup with no errors, visual or in debug.log.

    Favor – Can you please outline the exact steps to reproducing the issue?

    e.g. Pages > Add New > Save > Edit with Elementor. Etc.

    Ok I just set up a test site to try replicate it myself.

    I’ve worked out that if I edit the page in Elementor via the back end it wouldn’t trigger a fatal error.

    But if I view the page normally on the front end and then click Edit with Elementor from the admin bar at the top, I will get the ‘Your Site is Experiencing a Technical Issue’ email. And that’s without editing anything on the page and only opening it in Elementor.

    But it doesn’t seem to do it every time. Only if it’s the first time editing a page via the front end after updating the Instant Images plugin. I’ve tried editing other pages after the fact, but it doesn’t trigger the fatal error.

    I tried the same method on another website that’s running Elementor 3.10.2 / Elementor Pro 3.10.3 and updated the Instant Images plugin to the latest version. Then edited a page in Elementor via the front end and it triggered the same fatal error. After that, I tried editing other pages and didn’t get the fatal error.

    But it doesn’t stop me from editing that page or others or even viewing the website normally.

    Plugin Author Darren Cooney

    (@dcooney)

    Just released 5.2.0.2 hotfix.
    Hopefully that solves this issue. ??

    So far so good ??

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Version 5.2.0 error’ is closed to new replies.