Skip to content
WordPress Guide

Image Lightbox in WordPress: Click to Enlarge Images

Recent WordPress versions can open a larger view of an image when visitors click it. Here is how to switch it on for images and galleries, and when to use a plugin.

A hand on a white keyboard beside a monitor
7 sections · 6 min read
In this article · 7 sections

A customer mentions that they tried to read your price list on their phone, but the photo of it was too small and tapping it did nothing. Or your project photos are shown as neat thumbnails, and visitors keep zooming the whole page with two fingers to see any detail.

What you want is a lightbox: tap or click the picture and a larger version opens over the page, then closes again with one tap. Adding an image lightbox in WordPress used to mean installing a plugin. Recent versions of WordPress have one built in, called Enlarge on click (a few earlier releases labelled it Expand on click). This post shows how to switch it on for single images and galleries, when a plugin still makes sense, and the few things that stop it working.

Check what you are working with

  • Your WordPress version. The built-in lightbox arrived in recent 6.x releases. Go to Dashboard → Updates to see which version you run. If you are well behind, updating is worth doing anyway, after a backup.
  • The editor. Enlarge on click is a feature of the Image and Gallery blocks. If the page was built in Elementor, Divi or another builder, use the builder’s own lightbox setting instead; most have one in the image or gallery widget.
  • An existing lightbox. Some themes and gallery plugins already add a lightbox to every linked image. If yours does, adding a second one can make clicks open two overlays or none. Decide on one.
  • The size of the original. The enlarged view can only be as sharp as the file you uploaded. A small, low-resolution image will look no better when expanded. Our post on image dimensions and file size explains how big is big enough.

Lightboxes build on how WordPress stores every upload in several sizes. Our guide to WordPress images covers those sizes and the Media Library if you want the background.

Turn on click to enlarge for a single image

  1. Open the page and click the image so the Image block is selected. If the image is not yet on the page, our post on inserting an image into a WordPress page covers that first.
  2. In the block toolbar above the image, click the link button.
  3. From the options that appear, choose Enlarge on click.
  4. Save or update the page, then open it on the live site and click the image. A larger version should open over the page, with a close button.
  5. Test it on a phone too. Tapping should open it, and the close button should be easy to reach.

An image can either link somewhere or enlarge on click, not both. If the image was already linked to another page, choosing the lightbox replaces that link. That is usually what you want for a photo, but think twice for a banner that used to lead to a contact page.

Turning it on for every image

On block themes, recent versions also let you set this as a default for all Image blocks through the Styles panel in Appearance → Editor, under the settings for the Image block. If your version shows that option, it saves setting each image by hand. Individual images can still be changed afterwards. Classic themes do not have that panel, so set it image by image; the lightbox itself still works, because it belongs to the block rather than the theme.

A Gallery block has its own link setting that applies to every image inside it:

  1. Select the whole Gallery block, not one photo. The List View is the easiest way.
  2. In the sidebar, find the Link setting, or use the link button in the gallery toolbar, depending on your version.
  3. Choose Enlarge on click.
  4. Update the page and test a few images.

In current versions, a gallery set this way gets Previous and Next buttons inside the overlay, so visitors can step through the whole set without closing it, and the gallery settings let you show those buttons as icons or as text. Older versions opened one image at a time; if yours does, updating WordPress or a plugin adds the arrows. Setting up the gallery itself, its columns and captions, is covered in our post on adding a gallery to a WordPress page.

Using a plugin instead

The built-in option is enough for most business sites. A lightbox plugin is worth it when you need something the core feature does not offer, such as:

  • slideshows, zoom or captions shown inside the overlay,
  • a lightbox for images in old classic editor content that you do not want to convert,
  • videos or other content opening in the same kind of overlay.

Most lightbox plugins work on images that link to the media file. So the usual setup is to link the image or gallery to the media file rather than choosing Enlarge on click, and let the plugin catch the click. Choose one plugin, check its recent updates and reviews in the plugin directory, and test on a phone before you rely on it.

When an image lightbox in WordPress helps, and when it does not

Good candidates:

  • Photos of finished work where detail matters.
  • Menus, price lists, timetables and certificates shown as images.
  • Floor plans, maps and diagrams.
  • Product photos on a simple catalogue page.

Leave it off for logos, icons, decorative backgrounds and anything already shown at full size. A lightbox that opens the same image at the same size just annoys visitors.

A word on price lists and menus: an image of text is hard for many people to read even when enlarged, and impossible for a screen reader or a search engine. If the information matters, type it as real text on the page and keep the picture as an extra.

If clicking does nothing

  • The page is cached. Clear your caching plugin’s cache and try again in a private window.
  • A speed plugin delays scripts. Features that delay or combine JavaScript can stop the lightbox from starting. Exclude it, or test with that feature turned off.
  • Two lightboxes compete. Turn off the theme’s or plugin’s lightbox, or switch the image back to Media file and let the plugin handle it.
  • The link setting changed. Editing an image or replacing it can reset its link. Check that Enlarge on click is still selected.

For grids that have broken in other ways, such as missing thumbnails or a collapsed layout, our troubleshooting post on a gallery or lightbox that has stopped working goes through each cause.

This is one of many small settings an owner can manage alone. Our beginner’s guide to running WordPress gathers the rest in one place.

Frequently asked questions

Does a lightbox slow down my page?

The built-in lightbox is part of WordPress itself and adds very little to a page that uses it. Plugins vary, and some load their scripts on every page whether or not it has images. Run one of your image-heavy pages through a speed test with the plugin off and then on, and compare.

Can I use the lightbox on a Cover or Media & Text image?

No. Enlarge on click belongs to the Image block, and galleries have it because each photo inside one is an Image block. A Cover block treats its picture as a background, and the Media & Text block can only link its image somewhere. If a photo needs to open larger, place it with an Image block instead.

Will the lightbox show the caption?

The caption you type under an image appears on the page beneath the thumbnail. Whether it also appears inside the enlarged view depends on the lightbox. The built-in one focuses on the image itself, while many lightbox plugins can display the caption or title in the overlay through their settings.

A lightbox that works on a laptop but not on a phone, or one that stopped after a theme or plugin update, is the sort of fault our WordPress bug fix service handles, at ₹1,499 per incident onwards. A page address and a line on what happens when you click is enough to start with.

Next in this series: How to Download the WordPress Media Library

Is Your Website Working Properly?

Get a free website health check from WebMaintor. We'll review your website's speed, security, forms, and technical health — and tell you exactly what needs attention.

No obligation. No automated reports. A real review by our team.