Title: Define $wp_lightbox_2 as global variable
Last modified: January 6, 2022

---

# Define $wp_lightbox_2 as global variable

 *  [arzenigh](https://wordpress.org/support/users/arzenigh/)
 * (@arzenigh)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/define-wp_lightbox_2-as-global-variable/)
 * Could you please define $wp_lightbox_2 as global variable before assigning value
   to it?
 * I had an issue in jqlb_js(). This function could not access $wp_lightbox_2. I
   tested on 2 sites; one worked fine, another one didn’t. After I defined $wp_lightbox_2
   as global variable, it worked fine in both sites. Please check [https://developer.wordpress.org/reference/functions/register_activation_hook/#a-note-on-variable-scope](https://developer.wordpress.org/reference/functions/register_activation_hook/#a-note-on-variable-scope).

The topic ‘Define $wp_lightbox_2 as global variable’ is closed to new replies.

 * ![](https://ps.w.org/wp-lightbox-2/assets/icon-128x128.png?rev=1093845)
 * [WP Lightbox 2](https://wordpress.org/plugins/wp-lightbox-2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-lightbox-2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-lightbox-2/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-lightbox-2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-lightbox-2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-lightbox-2/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [arzenigh](https://wordpress.org/support/users/arzenigh/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/define-wp_lightbox_2-as-global-variable/)
 * Status: not resolved