How to Use WP Lightbox 2 WordPress Plugin

I got so many questions about the usage of WP Lightbox 2 plugin. First that a lot to all you to make this plugin a best plugin for image overlay effect. Some Features of WP Lightbox 2:

  • Works on all modern browsers.
  • Group related images in post and navigate through them with ease.
  • Backwards Compatibility.
  • No configuration required.
  • 5 Inbuilt theme.
  • Lightbox display of Gallery.

Apart from the above features we added some more like – Image Map, Shrink large images to fit smaller screens, Enable lightbox in comments (disables the nofollow attribute!) and many more which makes this plugin unique and most popular.

How to Use:

  • You can use WordPress image galleries and have them grouped and auto-lightboxed:
  • You can also add a rel="lightbox" attribute to any link tag to activate the lightbox. For example:
  • <a href=”images/image-1.jpg” rel=”lightbox” title=”my caption”>image #1</a>
  • Optional: Use the title attribute if you want to show a caption.
  • If you have a set of related images that you would like to group, simply include a group name in the rel attribute. For example:
  • <a href=”images/image-1.jpg” rel=”lightbox[roadtrip]”>image #1</a> <a href=”images/image-2.jpg” rel=”lightbox[roadtrip]”>image #2</a> <a href=”images/image-3.jpg” rel=”lightbox[roadtrip]”>image #3</a>
  • No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!
  • To disable lightboxing of an image link, just set any other rel-attribute: rel="nobox"

For developers:

  • Always have wp_footer(); just before the closing </body> tag of your theme, or you will break many plugins, which generally use this hook to reference JavaScript files
  • Apply lightbox to any content by running jqlb_apply_lightbox($your_content, "any ID"); It returns a string with all image links lightboxed, grouped by “any id”
  • Many JavaScript optimizers, combiners, minifiers, etc. conflict with wp_localize_script(), used to configure this plugin and many others.
  • If you experience problems with jQuery Lightbox, please disable all JavaScript-optimizing plugins. (Optimize Scripts, W3 Total Cache, WP Minify etc)
  • If you develop JavaScript optimizers for WordPress, please play nice with the default API

Latest updates and download plugin here.

View live demo with sample code here


GNU General Public License, v2 (or newer).

One of the great lighbox plugin.

More than 520,177 downloads.

Daily 1,000+ downloads. ActiveSupports

Live Demos, Support and Usage:

None found.
Share This Article

Join Over 8000+ Other Readers

Get latest updates in you inbox (free).
Free Gifts & Coupons.
Prize & Rewards worth 500$ monthly .

100% Privacy, No Spam !


  1. Ron Sussman says

    Hi. Great plug-in! A problem is that “Image x of xx” (x being numbers) always displays under the image and the caption is superimposed over that resulting in the text under the image being garbled. See: How do I stop “Image x of xx” from displaying? Thanks!

  2. ConnieM says

    I have WordPress galleries with titles and captions., at least one of them I want to show in the lightbox

    They are not shown in the lightbox.

    I need this, I do not need it for single photos. I need it for galleries
    so please tell me how to do it

    Cheers, Connie

  3. james cowart says

    i would like to be able to link my page head title (Click to view Gallery” at the top. I can’t manage to do that without adding either a blank light box image or having a duplicate of the first image. and help would be nice.

  4. Rick says

    Hi Pankaj,

    I’ve had this plugin for years and it has worked brilliantly – only now it just doesn’t appear to be working at all.

    I’m using the latest incarnation of Firefox on Windows 8/PC.

    I use the rel instruction in all instances so cannot pinpoint the problem.


  5. Tracey says

    Great looking plugin… Works well in all browsers Mac & PC & Android tablet, but does not work at all in Firefox (x platform)
    rel=”lightbox” atribute may be the prob?
    Any ideas??

    • says

      Hi Tracey, thanks for your great comment. this wp lightbox 2 plugin was working great on Firefox standard platform. Let me recheck.. will get back you soon.

      • Tracey says

        Hi Pankaj…

        Thanks for that, I will check back here soon or email me if you know a solution:) You are the expert!
        I did try FF on mac, PC & Android tablet.

  6. Miquel says

    Thanks for this wonderful plugin, I’ve used since the first version to html.
    Now I use the plugin for wordpress is great and easy to use.

    I have a request.
    It would make it possible to move pictures automatically? A “slideshow”.
    If possible, can you tell me how?
    Thank you very much.

  7. Jude says

    hi Pankaj,

    cam you please tel me how to make the lightbox show the image tilte – ie instead of the caption?

  8. Robert says

    It doesn’t work like I want it to work :/

    If I check AUTO LOAD all my galleries work with the lightbox as it should. But single images, tagged with rel=”nobox” still using the lightbox!

    If I UNCHECK AUTO LOAD I have the full control over single pictures but galleries doesn’t use the lightbox anymore and there is no way to add the lightbox to them.

  9. Phillip says

    Hey mate, loving the plugin, but just have one question (and it doesn’t appear to be answered anywhere yet!)

    How can I force the user to click the close button or hit the ESCAPE key (either one is fine) to exit out of the lightbox?

    What I am trying to avoid is having the lightbox close whenever the user clicks anywhere else on the image.

    For those wondering, I am adding a PayPal script into the Lightbox under the “Title” area and the script features drop down menus, however when someone makes a selection by clicking in the drop down, the entire Lightbox closes :(

    Here’s my idea in a semi working state:


  10. Jeroen van der Schenk says

    Great plugin! Just one small problem… I’m using multiple galleries on a page and it shows all images on the page in each gallery. Can I split the galleries so it will only show a selected amount of images in each gallery?

    This is an example of a page >>

    Thanks in advance for your help!

  11. Jeff Gray says

    WP Lightbox 2 doesn’t appear to work anymore. At least not with WP 3.8. Can you give it a look and let me know if it’s just me?

  12. min says

    hello i’m using images, but problem one i’m click image open two lightbox ON
    you’r lightbox and i think default lightbox or flickr default, i don’t know. it’s fix i can?
    WP Lightbox 2 is smooth moving i like it. thank you

  13. Oliver says

    Hi, I’d like to use this lightbox with YouTube and other video sites – could you please do this? This way – I can remove the extra plugin for that. Thanks.

  14. Belek says

    Hello! Thank you for this great plugin!
    How can I make to auto-size images in gallery? Now all my images has different sizes. I wan to all of them have same size.
    Thank you!

  15. Ankit Chaudhary says


    Can we put facebook like button on the lightbox?
    How can we stop hiding lightbox on click inside the lightbox.

    Please help!

    Thank You

  16. Whitney says

    I want the featured image to link directly to the lightbox instead of the featured image linking to a page with photos that then link the lightbox. Is this possible with your plugin?

  17. Paddy says

    It would be really nice, if there would be an option to hide ‘Title’ and ‘Caption’ in the lightbox.

  18. Rocky says

    Great plugin! I’m trying to put an lightbox overlay on my login located on the top navigation menu. Is it possible, if so, how?

  19. Jeremy says

    Using WP 3.5 and 2.28 of your plugin. My gallery code is this: [gallery ids="3954,3957,3955,3956,3952,3953"]

    It’s not being lightboxed. Can you advise? Thanks so much for your time!

  20. JR says

    Great plugin – but I don’t see the option in the plugin to allow “Image Map” links on the image that pops up in the lightbox? How do I enable or implement the “image map” for this plugin? I see you referenced it in the article as a new feature, but is it active yet? Thank you.

  21. Robert says

    Problem with the new Gallery in WP 3.5.1, Pictures in a Gallery are not shown in the LightBox. Only in the attachment side the LightBox is working.
    I trying to find why this is so, and I have even something as a layperson, out.
    This plugin adds an addition in the link of the images: rel = lightbox [xx]. Whether it’s single image or gallery.

    Now, I have seen single images this is the case, only when a new gallery does not. The reference rel = “lightbox [xx]” is missing and only reappears on the attachment side.

    Any clue why?

    • Pankaj Jha says

      This is working fine for me, may be some issue with your theme. Can you please try with some other theme and see if Lighbox plugin is working.

  22. Simone Conti says

    Good morning
    I’m testing your plugin on WP 3.5 but it’s not working.

    Inspecting the code I see that all my images report a rel=”lightbox[xyz]” attribute, and that’s OK, but I cannot see any lightbox javascript loaded into the page.

    Any known issue with WP3.5 and its new gallery system?

    Thank you

  23. Serkan Celik says

    great plugin, thanks! but you should improve some features especially changing color of box or disabling next&previous button etc. otherwise its ok.

  24. Dexter says

    hi, i’m using the plugin and just updated it. i wanted to change the color of ligthbox effect to gray. the version before this update has dropdown menu wherein you can choose color but i don’t seem to find it when i updated it. nice plugin.

Leave a Reply

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