Custom Fields
Re-Envisioned
Support MB Frontend Submission Fatal Error with Elementor : undefined function get_current_screen()

  • Creator
    Topic
  • #18456
    Resolved Cereal Concept
    Participant

    Hi !

    I’m facing a fatal error :

    Fatal error: Uncaught Error: Call to undefined function get_current_screen() in .../wp-admin/includes/template.php:1379
    Stack trace: 
    #0 .../vendor/meta-box/meta-box/inc/fields/taxonomy.php(359): remove_meta_box('thematiquediv', NULL, 'side') 
    #1 .../vendor/meta-box/meta-box/inc/fields/taxonomy.php(345): RWMB_Taxonomy_Field::remove_default_meta_box(Array) 
    #2 .../vendor/meta-box/meta-box/inc/field.php(587): RWMB_Taxonomy_Field::admin_enqueue_scripts(Array) 
    #3 .../vendor/meta-box/meta-box/inc/meta-box.php(166): RWMB_Field::call(Array, 'admin_enqueue_s...') 
    #4 .../vendor/meta-box/mb-frontend-submission/src/Form.php(65): RW_Meta_Box->enqueue()
    #5 .../vendor/meta-box/mb-frontend-submissio in .../wp-admin/includes/template.php on line 1379

    The frontend shortcode is on a custom woocommerce endpoint.
    Since the “My account” page has been modified with Elementor it generate this fatal error. Before it was working smoothly.

    My code is in a plugin with metabox has a composer dependency.

    I “fixed” it by adding a check before calling the shortcode but it’s not pretty 😉 :

    
    if (! function_exists('get_current_screen')) {
      function get_current_screen() {
        return null;
      }
    }
    

    Thanks in advanced for your time !
    Johann

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #18468
    Anh Tran
    Keymaster

    Hi Johann,

    Thanks for your feedback. We’ll check and fix the bug!

    #18506
    Anh Tran
    Keymaster

    Hi Johann,

    The bug is fixed here. Can you please check if that works for you?

    PS: I couldn’t replicate the bug, so my fix probably is just my logic.

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