Title: wp_enqueue_script not working properly
Last modified: August 19, 2016

---

# wp_enqueue_script not working properly

 *  Resolved [MAzCastro](https://wordpress.org/support/users/fmacastro/)
 * (@fmacastro)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/)
 * Hi
 * I’m using the `wp_enqueue_script` method to add scripts to a theme.
 * `wp_enqueue_script( 'farbtasticJS', '(..)farbtastic.js');`
 * when I look at the postProcessed source I can see the scripts correctly included
   in the head section, but they are completely ignored by the browser.
 * If I echo them, they are also correctly included in the head section, but now
   they are perfectly interpreted by the browser!
 * `echo("<script type='text/javascript' src='(..)farbtastic.js'></script>");`
 * weird!
 * I want to code this the proper way, and I don’t want to hard-code them by echoing
   the code.
 * Can someone please help me to understand what might be wrong?
 * Thanks
 * MAC

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

 *  [curlybracket](https://wordpress.org/support/users/veganist/)
 * (@veganist)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430714)
 * Did you call <?php wp_head(); ?> *after* wp_enqueue ?
 *  Thread Starter [MAzCastro](https://wordpress.org/support/users/fmacastro/)
 * (@fmacastro)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430827)
 * Hi veganist!
 * Did you mean to ask, if I have <?php wp_head(); ?> in my theme?
 * yes I do.
 * This is a weird case. I’ve done everything “by the book” and it doesn’t work.
   But if I do it “the wrong way” it works. I’m tempted to…
 * This is a function to place a JavaScript color-picker to my theme options (trough
   function.php), so we´re talking “admin context” not front-end.
 * I tried both:
 *     ```
       add_action('admin_print_scripts', 'myColorChoiceScriptz');
       add_action('admin_init','myColorChoiceStyles');
       ```
   
 * to hook my functions, but none seem to work properly (I’ve tried both combination
   for scripts and CSS)
 * They DO place the scripts, and the CSS in the markup, but then the browser ignores
   them!
 * The fist thing that comes to my mind is: – they are been processed in a wrong
   order, that’s why they are being ignored.
    But according the the Codex, “admin_init
   is triggered before any other hook when a user access the admin area”, so it 
   doesn´t make sense.
 * It probably is just a detail I’m missing here.
 * **HELP!**
 * MAC
 *  Thread Starter [MAzCastro](https://wordpress.org/support/users/fmacastro/)
 * (@fmacastro)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430828)
 * Hummmm
 * > Did you call <?php wp_head(); ?> *after* wp_enqueue ?
 * You might have a point that I missed, <?php wp_head(); ?> can be too “low” 🙂
   on the markup, thus making head scripts to load after the other “wicked stuff”
   I’m calling!
 * I’ll give it a try and place it at the beginning of the markup!
 * MAC
 *  Thread Starter [MAzCastro](https://wordpress.org/support/users/fmacastro/)
 * (@fmacastro)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430831)
 * Silly me!
 * I was not thinking. This has nothing to do with <?php wp_head(); ?> since this
   refers only to the admin section, and not the theme itself.
 * But it was a nice try 🙂
 * MAC
 * once again: **HELP!**
 *  Thread Starter [MAzCastro](https://wordpress.org/support/users/fmacastro/)
 * (@fmacastro)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430840)
 * Please grab some heavy stones and aim at my dumb head.
 * I was calling a JQuery-dependent-script, BEFORE I called the JQuery script itself.
 * Shoot at will, I deserve it.
 * MAC 🙂
 *  [curlybracket](https://wordpress.org/support/users/veganist/)
 * (@veganist)
 * [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430931)
 * :))

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

The topic ‘wp_enqueue_script not working properly’ is closed to new replies.

## Tags

 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * 6 replies
 * 2 participants
 * Last reply from: [curlybracket](https://wordpress.org/support/users/veganist/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/wp_enqueue_script-not-working-properly/#post-1430931)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
