Enqueue scripts to footer

Like this:-

function dequeue_my_scripts() {
   wp_dequeue_script('dgx_donate_paypalstd_script');
   wp_dequeue_script('next-handle-script');
   wp_dequeue_script('next-handle-script-2');
   /* and so on*/
}
add_action( 'wp_print_scripts', 'dequeue_my_scripts', 11 );

function enqueue_scripts_to_footer() {
   wp_enqueue_script('dgx_donate_paypalstd_script');
   wp_enqueue_script('next-handle-script');
   wp_enqueue_script('next-handle-script-2');
   /* and so on */
}
add_action( 'wp_footer', 'enqueue_scripts_to_footer' );

What’s wrong in this implementation?

EDIT:

I would also like to notify you that this is the correct implementation of what you are trying to achieve:-

function enqueue_scripts_to_footer() {
   wp_enqueue_script('dgx_donate_paypalstd_script', false, array(), false, true);
   wp_enqueue_script('next-handle-script', false, array(), false, true);
   wp_enqueue_script('next-handle-script-2', false, array(), false, true);
   /* and so on */
}
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_to_footer' );

Leave a Comment