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'm trying to implement a jQuery accordion for a client of ours. Basically, it's this tutorial (http://wp.tutsplus.com/tutorials/creative-coding/create-an-faq-accordion-for-wordpress-with-jquery-ui/) but having problems enqueuing the jQuery.

Basically, this is the code that is trying to enqueue the accordion script from the tutorial:-

add_action( 'wp_enqueue_scripts', 'fl_enqueue' );

function fl_enqueue() {
        wp_register_style('fl-jquery-ui-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/south-street/jquery-ui.css');
        wp_register_script('fl-custom-js', get_template_directory_uri() . '/faq/faq.js', 'jquery-ui-accordion', '', true);

When loading the page with Firebug, I'm getting the error TypeError: jQuery(...).accordion is not a function. I also cannot seem to see the accordion script being enqueued. However, the faq.js IS being loaded (which I think is odd, as it's a dependancy of the accordion script).

Baffled by this, any ideas?

share|improve this question
up vote 0 down vote accepted

The 3rd parameter in the call to wp_register_script() should be an array of dependencies - not a string.

Change this:

wp_register_script('fl-custom-js', get_template_directory_uri() . '/faq/faq.js', 'jquery-ui-accordion', '', true);


wp_register_script('fl-custom-js', get_template_directory_uri() . '/faq/faq.js', array('jquery-ui-accordion'), '', true);

share|improve this answer
Cheers that worked :) - loading the script but the accordion isn't working. Should be easy to figure out why though..... – Rhys Wynne Feb 8 '13 at 13:37

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.