Uncaught TypeError: $(…).accordion is not a function in wordpress

Hello I am using the jQuery UI accordion on a website with wordpress and I get the error: “Uncaught TypeError: $(…).accordion is not a function”

In my functions.php I load a app.js, where I have bundled the jQuery UI file and other jQuery plugins, with this function: wp_enqueue_script( ‘theme-js’, get_template_directory_uri() . ‘/js/app.js’, array(‘jquery’), null, true );

To bundle the app.js file I use webpack.

This is how i include jQuery UI in my main.js in webpack:

var $ = window.jQuery;
var jqueryUi = require("./jquery-ui.min.js");

I already disabled all plugins on my wordpress installation and deleted othe jQuery plugins.

Thank you.

Read more here: Uncaught TypeError: $(…).accordion is not a function in wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *