WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to use the recommended method of adding javascript files to WordPress, after reading this http://codex.wordpress.org/Function_Reference/wp_enqueue_script but I'm having a hard time figuring it out...

I've added this to my functions.php:

function enqueue_raluk_scripts() {
    wp_enqueue_script( 'tinynav-script', get_template_directory_uri() . '/scripts/tinynav.js', array('jquery') );
    wp_enqueue_script( 'superfish-script', get_template_directory_uri() . '/scripts/superfish.js', array('jquery') );

add_action( 'wp_enqueue_scripts', 'enqueue_raluk_scripts' );

and after looking inside the source code of my site I can see that they're appearing inside the tags.

The problem is that those two javascript files require jQuery 1.8.3 to work, and the WordPress built-in jQuery version is newer. How can I go about solving this issue without deregistering (which is a bad practice) the WordPress's default jQuery version? Is there any way to assign a specific jQuery version to be used by certain javascript files? Thanks.

share|improve this question
Please put your code in code blocks. And ideally seperate questions in single problems. – ialocin Sep 12 '13 at 12:37
jQuery is highly backwards compatible, why do you reason two unrelated scripts require precisely old 1.8.3 version? This is likely possible with jQuery's noConflict functionality but as such it's purely JS programming question and better asked at Stack Overflow. – Rarst Sep 12 '13 at 12:39
I know they require 1.8.3 because they both work if I use the jQuery 1.8.3 version instead of the default WordPress's 1.10.2 version. Can't I use a custom jQuery version for those two files, and the WordPress's default one for the rest? – Daniel Sarmas Sep 12 '13 at 13:16
@Rarst : I am having a problem with a script that works on 1.8.3 but not 1.10.2, and I have had trouble with jQuery version changes before. It is not as backward compatible as it might want to be, still this does sound like an Stack Overflow question. DanielSarmas : no, you can't assign a particular jQuery version to a particular script. Take this to Stack Overflow for fixing the scripts but don't use an old jQuery. – s_ha_dum Sep 12 '13 at 15:18
when you say they don't work with newer jQuery, what is the error you receive exactly? are you sure it's not a noConflict issue? all WordPress jQuery versions are not the same file as the ones available from the jQuery repository, they are modified to be in noConflict mode by default. – Milo Sep 12 '13 at 15:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.