Title: wp_script_is &amp; wp_enqueue_scripts
Last modified: August 20, 2016

---

# wp_script_is & wp_enqueue_scripts

 *  [basku](https://wordpress.org/support/users/bha100710/)
 * (@bha100710)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/wp_script_is-wp_enqueue_scripts/)
 * Hi 🙂
 * I am trying to modify an existing theme on local host to suit my needs. When 
   in debug mode I am getting the following notice:
 *     ```
       wp_script_is was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks
       ```
   
 * turns out the code that causes this notice is
 * _[ Moderator Note: Please post code or markup snippets between backticks or use
   the code button. As it stands, your code may now have been permanently damaged/
   corrupted by the forum’s parser. The blockquote and code combination doesn’t 
   work. ]_
 *     ```
       /**
            * Display Primary Menu
            */
   
           if($this->display('menu_primary')) {
   
               // Register
               register_nav_menu( 'primary',  __( 'Primary Menu', 'themater' ) );
   
               // Display Hook
               $this->add_hook($this->options['menus']['menu-primary']['hook'], 'themater_menu_primary_display');
   
               if(!wp_script_is('jquery')) {
                   wp_enqueue_script('jquery');
               }
   
               if(!wp_script_is('hoverIntent')) {
                   wp_enqueue_script('hoverIntent', THEMATER_URL . '/js/hoverIntent.js');
               }
   
               if(!wp_script_is('superfish')) {
                   wp_enqueue_script('superfish', THEMATER_URL . '/js/superfish.js');
               }
   
               $this->custom_js(themater_menu_primary_js());
           }
       ```
   
 * How do i correct this issue ?
    What changes do i need to make ?
 * Any help would be greatly appreciated.
    Thanks a lot 🙂
 * _[ Please do not bump, that’s [not permitted here](http://codex.wordpress.org/Forum_Welcome#No_Bumping).]_

Viewing 1 replies (of 1 total)

 *  [box](https://wordpress.org/support/users/boxoft/)
 * (@boxoft)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/wp_script_is-wp_enqueue_scripts/#post-3058072)
 * Hi basku,
 * It seems that you call the wp_script_js() function too early. According to the
   source code of this function at [http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/functions.wp-scripts.php#L161](http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/functions.wp-scripts.php#L161),
   you’ll see the error message if you call this function before either of the following
   3 hooks:
    - wp_enqueue_scripts
    - admin_enqueue_scripts
    - init
 * You may want to check the “TypeKit Code Snippet” written by Devin Price, a famous
   WordPress developer at [http://wptheming.com/2013/02/typekit-code-snippet/](http://wptheming.com/2013/02/typekit-code-snippet/).
   This function is called in a “wp_head” hook function. And the “wp_head” hook 
   is behind the “init” hook and the “wp_enqueue_scripts” hook according to [http://codex.wordpress.org/Plugin_API/Action_Reference](http://codex.wordpress.org/Plugin_API/Action_Reference).

Viewing 1 replies (of 1 total)

The topic ‘wp_script_is & wp_enqueue_scripts’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [box](https://wordpress.org/support/users/boxoft/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/wp_script_is-wp_enqueue_scripts/#post-3058072)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
