WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 am trying to load jquery-ui using wp_enqueue_script. I can check that jquery is loaded. jquery-ui is registered i.e. output of var_dump( wp_script_is( 'jquery-ui-tabs', 'registered' ) ); is bool(true) which indicates it is registered but it does not get included to the page.

I am using wordpress version 3.3.1

What is going wrong?

I am attaching the relavant snippet from functions.php from my theme.

function my_scripts_method() {
add_action('wp_enqueue_scripts', 'my_scripts_method');
share|improve this question
up vote 1 down vote accepted

Here's an alternative way to load a popular script like jquery-ui (using google api's)

// first, check to see if jquery-ui is already loaded 
if( !wp_script_is('jquery-ui') ) { 
        // you don't have to use googleapi's, but I think it helps. It saves the user's browser from loading the same script again if it has already been loade>
    wp_enqueue_script( 'jquery-ui' , 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js' );

*If you are still having problems, try using the full path to the "siteroot", which is usually the directory you will find the wp-content folder in. So to load jquery-ui locally from your theme folder if it's not connecting, try something like:

// first, check to see if jquery-ui is already loaded 
if( !wp_script_is('jquery-ui') ) { 
    wp_enqueue_script( 'jquery-ui' , '/home/<myusername>/<mysite.com>/wp-content/themes/<mycustomthemename>/js/jquery-ui.min.js' );

This only works if you have the file in that folder and inside of a js folder you created inside the theme. This is inadvisable if you need to change sites to a different url - but you will just have to update the folder if you do so.

share|improve this answer
Thanks. I was thinking of loading jduery from google cdn considering the time I've mucked around with trying loading jquery-ui . this seems good. – viyyer Jan 9 '12 at 22:23

I think you're looking for wp_enqueue_script, and not wp_register_script.

If the script comes with WordPress

 wp_enqueue_script( 'jquery-ui' );
share|improve this answer
I have tried doing wp_enqueue_script() and still I don't see jquery-ui loading on any page at all. – viyyer Jan 9 '12 at 21:49

You should register new scripts with the following method:

wp_register_script('jquery-ui', get_template_directory_uri().'/js/jquery-ui.js');

Currently your letting WordPress know of a new script with no source, you need to link to your source, too.

Also, after registering the script, in order to use it in your theme, you need to enqueue it:


Do that after the wp_register lines.

share|improve this answer
even for scripts which come installed with wordpress? – viyyer Jan 9 '12 at 21:35
Scripts installed with WordPress (which is a gray area for me so apologies if I lack the knowledge) do not require wp_register_script as @Shane said, but just the wp_enqueue_script. If it does not load, it's either because it does not come with wordpress or you have no placed wp_head() in the header.php file. – Asko Jan 9 '12 at 21:52
I can assure you that wp_head(); is present in header.php and I know that it is present in wp-includes/js/jquery directory. I think there is an general issue with loading jqueryui with wordpress 3.3+ . From some links posted on this forum It does seem a problem across the board. wordpress.stackexchange.com/questions/36503/… wordpress.stackexchange.com/questions/38102/… wordpress.stackexchange.com/questions/36503/… – viyyer Jan 9 '12 at 22:00
If it is a bug, then your only solution is either to wp_register_script that file which is in the wp-includes folder or add the file to your theme and wp_register_script to there. – Asko Jan 9 '12 at 22:08

Your Answer


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

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