admin javascript depends on underscore
-
in
includes/class-galleries.phptheadmin-gallery.jsis being defined like so :
wp_enqueue_script( 'responsive-lightbox-admin-gallery', RESPONSIVE_LIGHTBOX_URL . '/js/admin-gallery.js', array( 'jquery' ), $rl->defaults['version'], false );However it also depends on underscore. In case of other scripts that push e.g. underscore to the footer, the
admin-gallery.jsfails to load withUncaught ReferenceError: _ is not defined at Object.init (admin-gallery.js?ver=2.2.1:15) at admin-gallery.js?ver=2.2.1:331 at admin-gallery.js?ver=2.2.1:333This can be fixed by adding the proper dependency into the array like so :
wp_enqueue_script( 'responsive-lightbox-admin-gallery', RESPONSIVE_LIGHTBOX_URL . '/js/admin-gallery.js', array( 'jquery', 'underscore' ), $rl->defaults['version'], false );
The topic ‘admin javascript depends on underscore’ is closed to new replies.