Make image open in lightbox in Divi


Jun 27, 2018 | Divi Tips | 6 comments

Say you added an image in the text editor and want it to open in a lightbox popup.

In the editor make the image you placed there a link and link it to itself.

Then, paste the following class into the HREF tag (not the image tag).


So, your link will look something like this:

Click the image below to see it work.


  1. This no longer works Divi v. 4.9.2 WP v. 5.7 🙁

    • Hi Paka,
      It’s still working on the image above and the site is on Divi v. 4.9.2 and WP v. 5.7.

  2. Hi, I’ve added the et_pb_lightbox_image class to a button and it works almost perfect for me, but after closing the lightbox it won’t reopen. Do you know why this is?


  3. This Divi Tip helped me figure my problem out. Thank you.
    Also you don’t need to add a plug-in, and it should be future-proof because it uses a class.

    This works great for images inserted in text – for instance in a blog post. I didn’t want clients to have to use the Divi Builder for blog posts, but I wanted the images inserted in posts using the text editor to open in a lightbox.
    For images inserted in a blog post:
    1. Insert image in text using the button “add Media”
    2. click on image – a small pop up will appear with positioning icons and a pencil icon (edit). Click on the pencil icon.
    3. a dialog box will appear with “image details”. Here you can fill in alt text, caption, alignment etc. Under “Link To” choose “Media File”
    4. Choose also “Advanced options” dropdown, and here after “Link CSS Class” write “et_pb_lightbox_image” (without the quotation marks)

  4. Would there be any way to get multiple images posted through the text or code editor to open in the same lightbox so one could advance through a gallery of images rather than loading one at a time? There’s Javascript out there for grouping individual Divi Image module images to a single lightbox through CSS classes. Am hoping to find something similar for images through text or code modules.

  5. This still works if you have a hidden image module that has a any picture with the lightbox option activated.


Submit a Comment

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

More Tips

Ad - Web Hosting from SiteGround - Crafted for easy site management. Click to learn more.

Cloudways Hosting

WPEngine Hosting

Pressable Hosting

AccuWeb Hosting

Ask the Divi Guy a Question

"*" indicates required fields