• Resolved thomask

    (@thomask)


    error in JS console with wordfence
    Uncaught TypeError: $(…).ajaxError is not a function
    at Object.init (admin.ajaxWatcher.1573059078.js?ver=7.4.1:7)
    at HTMLDocument.<anonymous> (admin.ajaxWatcher.1573059078.js?ver=7.4.1:83)
    at e (jquery-3.4.1.slim.min.js:2)
    at t (jquery-3.4.1.slim.min.js:2)

    The page I need help with: [log in to see the link]

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

    (@wfgerald)

    Hey @thomask,

    It sounds like there might be a conflict either with the theme or one of the plugins you’re using, could you try temporarily switching to a default theme if you’re not already using one and disabling all other plugins then reactivating them one by one to see if the issue persists?

    To do so I recommend the Health Check & Troubleshooting plugin which allows you to disable all plugins and switch to a default theme, but only for your user.

    Please let me know how it goes.

    Thanks,

    Gerroald

    jhars5511

    (@jhars5511)

    I no longer have a web site but I still get the Forum email. How can this be stopped?
    Thank yoJack

    Thread Starter thomask

    (@thomask)

    Oh @wfgerald, i see. The problem is, that i use the latest jQuery version (3.4.1), not that wp built-in from several years old ver. 1.2 branch. Interesting, you are the only plugin, that got problems with that.
    P.S: this is my setup if you want to test it with modern jquery

    
    //Remove JQuery migrate
    function remove_jquery_migrate($scripts)
    {
        if (!is_admin() && isset($scripts->registered['jquery'])) {
            $script = $scripts->registered['jquery'];
            
            if ($script->deps) { // Check whether the script has any dependencies
                $script->deps = array_diff($script->deps, array(
                    'jquery-migrate'
                ));
            }
        }
    }
    
    add_action('wp_default_scripts', 'remove_jquery_migrate');
    
    //Making jQuery to load from Google Library
    function replace_jquery() {
    	if (!is_admin()) {
    		// comment out the next two lines to load the local copy of jQuery
    		wp_deregister_script('jquery');
    		wp_register_script('jquery', '//code.jquery.com/jquery-3.4.1.slim.min.js', false, NULL,true);
    		wp_enqueue_script('jquery');                                                                           
            wp_script_add_data( 'jquery', 'integrity', 'sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=');
            wp_script_add_data( 'jquery', 'crossorigin', 'anonymous' );
    	}    
    }
    add_action('init', 'replace_jquery');
    
    WFGerroald

    (@wfgerald)

    Hey @thomask,

    I was discussing this with a colleague this morning. It seems the reason this is likely happening is that you’re loading the slim version of jQuery, which doesn’t contain all of the necessary functions/calls. If you load the full 3.4.1 version everything should work just fine. Below is an article that goes more in-depth on the topic.

    https://webdesign.tutsplus.com/tutorials/quick-tip-beware-when-using-the-slim-version-of-jquery–cms-30935

    Please let me know if this helps.

    Thanks,

    Gerroald

    Hey @thomask,

    We haven’t heard back from you in a while, so I’ve gone ahead and marked this thread as resolved.

    Please feel free to open another thread if you’re still having issues with Wordfence.

    Thanks,

    Gerroald

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Uncaught TypeError: $(…).ajaxError is not a function’ is closed to new replies.