I am working on a site that uses jQuery for a number of functions but I am having a repeating error:

hoverIntent is not a function

I have referenced similar questions on this forum and they almost universally say that it is due to multiple references to jQuery, however, I have carefully reviewed the code and the source code and cannot find any duplicate references.

There is just this one in functions.php

// Load jQuery
if ( !is_admin() ) {
   wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"), false);
   wp_register_script('jquery', ("js/jquery.dropmenu.js"), false);
   wp_register_script('jquery', ("js/jquery.dropmenu2.js"), false);  

I would really appreciate another set of eyes to help pinpoint and resolve this dilemma.

  • Are you by any chance enqueuing jquery after the script that depends on it?
    – gdaniel
    Jul 25 '14 at 16:33
  • Good question, but jQuery is listed first.
    – forrest
    Jul 25 '14 at 17:22

According to the wp_register_script() Codex the first parameter handle should have a unique name.

If we look at the paramters of the wp_register_script() function it breaks down like this:

wp_register_script( $handle, $src, $deps, $ver, $in_footer );

So your wp_register_script() function should also break down into a similar way:

wp_register_script( 'dropmenu1', get_bloginfo('template_directory') . '/js/jquery.dropmenu.js', array('jquery'), '', false);

I discovered that the HoverIntent is optional for the drop menu plugin. I turned that off and everything is working correctly now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.