Software Developer

Move edd-ajax.js to Footer

This page is in the Code Graveyard where I lay to rest snippets of code that I don't use anymore. Some have lost their usefulness due to the evolving nature of the web, while others have been replaced with better code. "Be Ye Warned!"

UPDATE: Easy Digital Downloads version 2.7 moved the edd-ajax script to the footer. Therefore, this page is no longer necessary.

This moves the edd-ajax.js file (from Easy Digital Downloads Plugin) to the footer instead of the head. Please note that there is no guarantee that this will work smoothly on your site. EDD loads it in the head, rather than footer, by default, and that is the way it is intended to work. The following snippet works for me, but I keep a close watch through every update.

Use this at your own risk.

/**
* move edd-ajax.js to footer
*/
function isa_move_edd_ajax() {
	wp_dequeue_script( 'edd-ajax' );
	wp_enqueue_script( 'edd-ajax', plugins_url( '/easy-digital-downloads/assets/js/edd-ajax.min.js'), array( 'jquery' ), EDD_VERSION, true );
}
add_action( 'wp_enqueue_scripts', 'isa_move_edd_ajax' );

By

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]