Title: admin javascript depends on underscore
Last modified: November 21, 2019

---

# admin javascript depends on underscore

 *  [disagree](https://wordpress.org/support/users/disagree/)
 * (@disagree)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/admin-javascript-depends-on-underscore/)
 * in `includes/class-galleries.php` the `admin-gallery.js` is 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.js` fails to load with
 *     ```
       Uncaught 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:333
       ```
   
 * This 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 );`
    -  This topic was modified 6 years, 6 months ago by [disagree](https://wordpress.org/support/users/disagree/).

The topic ‘admin javascript depends on underscore’ is closed to new replies.

 * ![](https://ps.w.org/responsive-lightbox/assets/icon-256x256.png?rev=3460874)
 * [Responsive Lightbox & Gallery](https://wordpress.org/plugins/responsive-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/responsive-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/responsive-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/responsive-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/responsive-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/responsive-lightbox/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [disagree](https://wordpress.org/support/users/disagree/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/admin-javascript-depends-on-underscore/)
 * Status: not resolved