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

To use jQuery UI AutoComplete, I loaded the following scripts:


wp_enqueue_style( 'jquery-ui-autocomplete',   $ul .'/css/jquery-ui-1.8.custom.css' );
wp_register_script('jquery-ui-autocomplete', $url .'/js/jquery-ui/jquery.ui.autocomplete.min.js', array( 'jquery-ui-widget', 'jquery-ui-position' ), '1.8.2', true );
wp_enqueue_script( 'jquery-ui-autocomplete', $url .'/js/jquery-ui/jquery.ui.autocomplete.min.js', '1.1', true );

After the above scripts, I loaded my own js which includes the following code:

        // code...

Firebug shows all scripts and style are loaded and gives error message of "$ is not a function". How can I correct this error?

share|improve this question
up vote 3 down vote accepted

WordPress requires no conflict wrappers for jQuery.

        // code...


        // code...
share|improve this answer
Thanks! This solved the pain! – Jenny Jul 10 '12 at 4:28

I use for wp_enqueue_scrip following one liner:

wp_enqueue_script('jquery-ui-autocomplete', '', array('jquery-ui-widget', 'jquery-ui-position'), '1.8.6');

As jquery-ui-autocomplete is part of the WP Framework -> see here

In my coding I use the autocompletion feature the same way @Chris_O mentioned:

    jQuery(document).ready(function($) {

var availableTags = ["Batman", "Spiderman", "Hulk"];
            $( "#foo" ).autocomplete({
                source: availableTags

To load so many scripts, like in your example is not neccessary, cause jquery is loaded by default from the wp framework. I would recommend to clean up your script initializing and reduce it to the min, load only the scripts you needed. Please take a look at the wp codex.

share|improve this answer
Where does that availableTags come from? – toscho Nov 8 '12 at 14:13
this is my list with my autocomplete values. See edit on my post. If you type 'Ba' it will suggest 'Batman'. – mybecks Nov 8 '12 at 14:55
Could you go into more detail please how about how to properly enqueue and use scripts that are already part of the wordpress framework? I too want to use autocomplete, and I saw in the docs where it's included. I do not see them in my header, and my autocomplete script doesn't work. (although, it does work fine if I use a page template header that links only to the jquery autocomplete files from the autocomplete demo). Do I need to do something special before I can use a script like you have in your answer? – user658182 May 12 '14 at 7:07

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.