The error
Slick slider library is being used in the “Ivr – RE Collective Properties Carousel” plugin for this project. Sometimes some of the pages generate this error:
jquery.min.js?ver=3.6.0:2 jQuery.Deferred exception: jQuery(...).slick is not a function
TypeError: jQuery(...).slick is not a function
It is suggested to take these approaches to fix the error:
- Attempt 1 – Make [ ivr-rec-carousel-script.js ] depends on [ slick.min.js ] using wp_register_script( ).
- Attempt 2 – Use jQuery in noConflict mode.
Attempt 1 : Make [ ivr-rec-carousel-script.js ] depends on [ slick.min.js ] using wp_register_script( )
Should dependencies be input in both wp_register_script/style and wp_enqueue_script/style?
The answer is NO. We don’t need to specify the dependencies twice.
The reason behind is that, you don’t have to register the script at all before you enqueue it, you can just use wp_enqueue_script on its own and it will register it if its not already registered – this is why you have the same options (including setting the dependencies) in both functions.
More details are in this Stack Overflow discussion.
