2

Anyone else having issues with WordPress 3.6 and the Accordion UI?

I have a website that was working just fine till I updated it to WordPress 3.6. The accordion menu stopped working. No errors.

Enqueue

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

My JS

jQuery('#accordion').accordion({ 
    heightStyle: 'content', 
    collapsible: true, 
    active: false
});

Nothing happens at all when I click on the accordion links. Everything loads, correctly. No errors. I heard about issues with WordPress 3.6 and jQuery UI - but have not been able to find anyone with the same issue.

2 Answers 2

1

I'm not sure if it's because "accordion" all of the sudden became a reserved word in wordpress. But once I switched my wp_enqueue_script/wp_register_script handle from accordion to myaccordion - everything worked.

3
  • Probably clashes with $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 ); from wp-includes/script-loader.php.
    – RRikesh
    Commented Aug 15, 2013 at 5:11
  • Yeah, it's just weird that it was working before the update but not after.
    – gdaniel
    Commented Aug 15, 2013 at 15:15
  • 1
    The line wasn't present in the previous WordPress version.
    – RRikesh
    Commented Aug 16, 2013 at 4:53
-1

As an alternative you can use the Jquery UI (1.10.3) already embedded in Wordpress 3.6, with just:

wp_enqueue_script( 'jquery-ui-accordion');

http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress

2
  • It is already being added as a dependency.
    – RRikesh
    Commented Aug 15, 2013 at 5:13
  • As I said, AS ALTERNATIVE, instead using your jquery-ui file in your template directory, you just could use the Wordpress version, already embedded in, with only one line as I wrote above. Commented Aug 16, 2013 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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