• Resolved therealgilles

    (@chamois_blanc)


    Hello,

    I think there is an issue with the code when doing ajax requests. I got a PHP error saying get_current_screen() was undefined.

    [19-May-2018 19:54:50 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function get_current_screen() in .../public_html/wp-content/plugins/pods/classes/PodsInit.php:347
    Stack trace: 
    #0 .../public_html/wp-includes/class-wp-hook.php(286): PodsInit->register_assets('')
    #1 .../public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #2 .../public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #3 .../public_html/wp-login.php(103): do_action('login_enqueue_s...')
    #4 .../public_html/wp-login.php(1011): login_header('Log In', '', Object(WP_Error))
    #5 .../public_html/wp-content/plugins/login-with-ajax/login-with-ajax.php(234): include_once('/home/89942.clo...')
    #6 .../public_html/wp-content/plugins/login-with-ajax/login-with in .../public_html/wp-content/plugins/pods/classes/PodsInit.php on line 347

    I am thinking it has to do with this code:

        if ( is_admin() ) {
          $screen = get_current_screen();

    which appears twice in plugins/pods/classes/PodsInit.php. Maybe it should be replaced with:

        if ( is_admin() && !wp_doing_ajax() ) {
          $screen = get_current_screen();
    • This topic was modified 6 years, 10 months ago by therealgilles.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with get_current_screen()’ is closed to new replies.