• Hello,

    I’ve been trying to improve my page loading speed, and have been looking at moving my jQuery load to the foot of the page. I moved the call successfully without adverse effects while the EDD plugin was deactivated; but when the plugin is activated, my script reverts to appearing in the page head. Is this strategy incompatible with the plugin?

    https://wordpress.org/plugins/easy-digital-downloads/

Viewing 3 replies - 1 through 3 (of 3 total)
  • How are you moving the scripts? Can you show me?

    Thread Starter PandaJuggler

    (@pandajuggler)

    Thanks for the quick response. I put the following in functions.php:

    function my_scripts_method() {
    	wp_deregister_script('jquery');
    	wp_register_script('jquery','/wp-includes/js/jquery/jquery.js',false,null,true);
    	wp_enqueue_script('jquery');
    }    
    
    add_action('wp_enqueue_scripts', 'my_scripts_method');

    Initially I only had the wp_enqueue_script line in my function with $in_footer set to true, but this didn’t work. I added the deregister/register lines after reading that WordPress registers certain core scripts (like jQuery) in an array which prevents them from being moved from the head – perhaps for good reason, I’m just trying to see what’s possible.

    You would need to do the same thing with all of the scripts loaded by EDD (and other plugins), not just jQuery itself.

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

The topic ‘Moving Scripts to the Footer’ is closed to new replies.