wp_register_script was called incorrectly

You need to hook your function into either wp_enqueue_scripts, admin_enqueue_scripts, or init. wp_footer is too late to enqueue scripts; they need to be enqueued before the wp_head() function is called.

The fifth argument of the wp_enqueue_scripts() function, when set to true, will load the script in the page footer instead of header. From the Codex:

You have to enqueue your script before wp_head is run, even if it will be placed in the footer

Leave a Comment