You’re using an invalid action:
add_action('wp_enqueue_script', 'run_js_script');
The correct action is wp_enqueue_scripts
(plural), not wp_enqueue_script
(singular). Use this instead:
add_action('wp_enqueue_scripts', 'run_js_script');
Edit
Same problem here:
add_action('wp_register_script', 'register_script');
Just hook it into wp_enqueue_scripts
for simplicity:
add_action('wp_enqueue_scripts', 'register_script');
Actually, two better options:
- Put your
wp_register_script()
call in the samerun_js_script
callback as yourwp_enqueue_script()
call. - Eliminate
wp_register_script()
call entirely, and just use the full parameters inwp_enqueue_script()
.