Title: admin_head and wp_enqueue_script
Last modified: August 18, 2016

---

# admin_head and wp_enqueue_script

 *  Resolved [latz](https://wordpress.org/support/users/latz/)
 * (@latz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/admin_head-and-wp_enqueue_script/)
 * I want to use jquery in my plugin’s option page (the plugin itself does not need
   jquery). I could do this by simply adding a “wp_enqueue_script(‘jquery’)” in 
   my code. This works fine but unfortunately it also loads jquery everytime the
   blog is displayed and not only if the option page is loaded.
 * To avoid this overhead I tried to load jquery the following way:
 *     ```
       function load_jquery() {
         wp_enqueue_script('jquery')
       }
       add_action('admin_head', 'load_jquery');
       ```
   
 * load_jquery() is executed but the jquery loading code does not appear in the 
   head of the option page. Any ideas?

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

 *  Thread Starter [latz](https://wordpress.org/support/users/latz/)
 * (@latz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/admin_head-and-wp_enqueue_script/#post-655493)
 * Ok, answering myself :-):
 * the solution seems to be totally different than I thought:
 *     ```
       if (is_admin())
           pb_add_jquery();
       ```
   
 * I don’t know if this is the “correct” way but it seems to work.
 *  [Roland Rust](https://wordpress.org/support/users/wpdprx/)
 * (@wpdprx)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/admin_head-and-wp_enqueue_script/#post-655516)
 * add_action(‘admin_print_scripts’, ‘your_function_calling_a_javascript’);
 *  Thread Starter [latz](https://wordpress.org/support/users/latz/)
 * (@latz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/admin_head-and-wp_enqueue_script/#post-655529)
 * Thank you, works fine.

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

The topic ‘admin_head and wp_enqueue_script’ is closed to new replies.

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [latz](https://wordpress.org/support/users/latz/)
 * Last activity: [18 years, 6 months ago](https://wordpress.org/support/topic/admin_head-and-wp_enqueue_script/#post-655529)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
