• The issue happens on wp-login.php

    
    Uncaught SyntaxError: missing ) after argument list @ wp-login.php?redirect_to=.....
    Uncaught ReferenceError: wp is not defined @ wp-login.php?redirect_to=.....
    

    navigates to this line of code :

    
    <script type='text/javascript'>( 'fetch' in window ) || document.write( '<script src="http://website.com/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0' defer "></scr' + 'ipt>' ); ...</script>
    

    as described here:
    WordPress v5.0.3 Gutenberg & JS error “Uncaught SyntaxError: missing ) after argument list”

    The problem was in the PHP hook added defer to script

    The solve: Delete/disable the adding ‘defer’ PHP-hook or add some conditions to not touch Gutenberg scripts.

    which is not possible yet to configure from the Plugin settings.

    any help?

    # UPDATE

    i temporarily fixed this from the plugin async-javascript/async-javascript.php by also checking if current page is wp-login then require asyncjsBackendClass.php

    
    // Check if current page is wp-login.php
    function is_wplogin(){
        $ABSPATH_MY = str_replace(array('\\','/'), DIRECTORY_SEPARATOR, ABSPATH);
        return ((in_array($ABSPATH_MY.'wp-login.php', get_included_files()) || in_array($ABSPATH_MY.'wp-register.php', get_included_files()) ) || (isset($_GLOBALS['pagenow']) && $GLOBALS['pagenow'] === 'wp-login.php') || $_SERVER['PHP_SELF']== '/wp-login.php');
    }
    
    if (is_admin() || is_wplogin()) {
        require_once('asyncjsBackendClass.php');
        // etc..
    } // else..
    

    but once the plugin updates. it will revert to yours. so? i suggest adding a checkbox to give an option to exclude wp-login from the plugin settings.

    • This topic was modified 5 years, 7 months ago by amrsubzero.
    • This topic was modified 5 years, 7 months ago by Yui.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    can you try downloading & installing https://github.com/futtta/async-javascript/archive/master.zip to replace the current version of AsyncJS and see to what extent that fixes things amrsubzero ?

    frank

    Thread Starter amrsubzero

    (@amrsubzero)

    Errors in browser console on wp-login.php :

    
    Uncaught ReferenceError: wp is not defined @ wp-login.php?....
    

    Points to:

    
    wp.i18n.setLocaleData( localeData, domain );
    

    Plugin settings applied:

    
    - Enable Async JavaScript? (Checked)
    - Also enable Async JavaScript for logged in users? (Checked)
    - Also enable Async JavaScript on cart/ checkout pages? (Checked)
    
    - Async JavaScript Method (Defer)
    - jQuery (Exclude)
    
    - Async JavaScript For Plugins - Plugin: Autoptimize (Enabled) (Defer)
    

    Issue also happens with all plugins disabled but Async Javascript also on different themes.

    • This reply was modified 5 years, 7 months ago by amrsubzero.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, can you now try excluding wp-includes ?

    Thread Starter amrsubzero

    (@amrsubzero)

    Excluded wp-includes in Script Exclusion and the errors gone.

    we need to make it more simple to configure for example like a checkbox to exclude entire admin area?

    Thanks.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, feel free to do a PR on Github to make it so 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Exclude wp-login & Admin area’ is closed to new replies.