Explainers · Explainer
What Is WordPress Lightbox? Explained

Short answer
A WordPress lightbox is an overlay that opens an image at a larger size on top of the page when someone clicks it. Since WordPress 6 point 4, the Image block includes a built-in Expand on click option, and plugins add galleries, video and extra controls.
Key takeaways
- A lightbox enlarges an image in an overlay without leaving the page.
- WordPress 6.4 added a built-in lightbox through the Image block's Expand on click option.
- Block themes can turn it on for all images through theme.json or Styles.
- Plugins add slideshows, video support and classic editor support.
- Use one lightbox solution at a time to avoid conflicts.
What is a WordPress lightbox?
A WordPress lightbox is an overlay that opens an image at a larger size on top of the page when a visitor clicks it, dimming everything behind it until they close it.
The visitor stays on the same page. They click, look at the full image, then close the overlay and keep reading.
Without a lightbox, clicking an image either does nothing or opens the raw file in a new page. That breaks the flow and sends people away from your content.
Photographers, recipe bloggers, product sites and anyone who posts screenshots use lightboxes to show detail without making the page heavy.
What does a lightbox look like to visitors?
Visitors see the page fade behind a dark layer while the clicked image grows to fill most of the screen, with a close button in the corner.
On phones, the image fills the width of the screen. Tapping the close button or the dark area returns them to the same scroll position.
That small detail matters. People do not lose their place in a long article or product page.
Does WordPress have a built-in lightbox?
Yes, since WordPress 6.4 the Image block has an Expand on click option that opens the image in a built-in lightbox without any plugin.
Before that release, you needed a plugin or theme feature for this. Now it is part of core for anyone using the block editor.
The feature uses the Interactivity API in core, so the overlay loads only the small script it needs.
The WordPress 6.4 release page lists the lightbox among the changes in that version.
How do you turn on the lightbox for an image?
Select the Image block, open the link settings in the block toolbar, and choose Expand on click so the image opens in the lightbox when clicked.
Here is the short version:
- Edit the post or page in the block editor.
- Click the image you want to enlarge.
- Click the link icon in the block toolbar.
- Choose Expand on click.
- Update or publish, then test on the front end.
Use a large original file. If you upload a small image, the lightbox has nothing bigger to show.
Add useful alt text while you are in the block settings. It describes the image for screen readers whether or not the lightbox is used.
The Image block documentation explains every setting on the block, including links and sizes.
Can you turn on the lightbox for every image at once?
Yes, in block themes you can enable the lightbox for all Image blocks through the Site Editor styles or with the lightbox setting in theme.json.
The developer handbook page on the lightbox setting shows the exact keys. You can turn it on by default and decide whether editors can change it per block.
A minimal theme.json example looks like this:
{
"version": 3,
"settings": {
"blocks": {
"core/image": {
"lightbox": {
"enabled": true,
"allowEditing": true
}
}
}
}
}
Edit theme.json in a child theme, not the parent theme. Updates to the parent theme would wipe your change. Our child theme explainer covers why.
Does the lightbox work with galleries?
Yes, each image inside a Gallery block is an Image block, so you can set Expand on click on the gallery images and visitors can open them in the overlay.
The built-in version focuses on single images. It is not a full slideshow with thumbnails, captions panels or downloads.
If you want visitors to swipe through a whole gallery in one overlay, a gallery plugin with its own lightbox is usually a better fit.
See our guide on how to create a gallery in WordPress for layout options before adding a lightbox.
When should you use a lightbox plugin instead?
Use a plugin when you need slideshows, video or PDF support, social sharing, zoom, deep links or a lightbox in a classic editor site.
Core keeps the feature simple. Plugins add more controls.
| Need | Built-in lightbox | Lightbox plugin |
|---|---|---|
| Single image enlarge | Yes | Yes |
| Swipe through a gallery | Limited | Usually yes |
| Videos and iframes | No | Often |
| Classic editor content | No | Usually yes |
| Extra scripts to load | Very small | Varies by plugin |
| Cost | Free | Free or paid |
Free options on the WordPress plugin directory include tools that add a lightbox to Gallery and Image blocks, plus older all-purpose plugins.
Jetpack has a Carousel feature that turns gallery clicks into a full-screen slideshow. Check Jetpack's Carousel documentation for current options.
Page builders such as Elementor also ship their own lightbox settings. If you use one, start there before adding another plugin.
Does a lightbox slow down WordPress?
The built-in lightbox adds very little weight, but some plugins load extra JavaScript and CSS on every page, which can slow sites down if you stack several.
The bigger cost is usually the images. A lightbox shows the large file, and that file must download when someone clicks.
Keep originals sensibly sized. A 6000-pixel photo is rarely needed on the web.
Use lazy loading for the images on the page. Our guide on how to lazy load images in WordPress explains how WordPress handles this by default.
Do not run two lightbox plugins at once. They fight over the same click and can open two overlays or none.
Is a lightbox good for accessibility?
A well-built lightbox can be accessible if it traps focus inside the overlay, closes with the Escape key, has a visible close button and gives each image proper alt text.
The core lightbox was built with keyboard support in mind. Plugins vary, so test any plugin you choose.
Try it yourself. Tab to the image, press Enter, then press Escape. Focus should return to where you started.
The W3C's dialog pattern guidance describes how modal overlays should behave for keyboard and screen reader users.
Alt text still matters most. The lightbox only enlarges the picture, it does not describe it.
Why is my WordPress lightbox not working?
The most common causes are using a classic block or old image link, a plugin conflict, a caching or minify setting that breaks scripts, or an image that links to a custom URL.
Work through these checks:
- Make sure the image is an Image block, not part of a Classic block.
- Confirm the link setting is Expand on click, not a media file or custom URL.
- Clear page and browser caches, then reload.
- Turn off JavaScript minify or combine options briefly to test.
- Deactivate other lightbox plugins and test again.
Our guide on how to fix plugin conflicts shows a safe way to test one plugin at a time.
Is a lightbox the same as a popup?
No, a lightbox shows media the visitor chose to open, while a popup usually appears on its own to show a message, offer or form.
Some popup plugins call their overlays lightbox popups, which adds to the confusion.
For image viewing, stick with a media lightbox. For sign-up forms or notices, see our guide on how to add a popup on WordPress.
Frequently asked questions
Do I need a plugin for a lightbox in WordPress?
Not for single images. The Image block has a built-in Expand on click option that opens images in an overlay. You only need a plugin for extras like gallery slideshows, video support or classic editor content.
Why is Expand on click missing from my image block?
Your WordPress version may be older than 6.4, the image may be inside a Classic block, or your theme may have disabled the option in its settings. Update WordPress and convert the content to blocks.
Can a lightbox show videos?
The built-in lightbox only handles images. Many lightbox and gallery plugins can open YouTube, Vimeo or self-hosted videos in the same kind of overlay.
Does a lightbox hurt SEO?
No. Search engines still see the image and its alt text in the page. Just keep image files a sensible size so the page stays fast.
Can I turn off the lightbox for one image?
Yes. Select that Image block, open the link setting, and choose a different option or no link. If your theme enables the lightbox globally, editing must be allowed for this to work.
Sources
- Lightbox setting WordPress Developer Resources
- Image block WordPress.org Documentation
- WordPress 6.4 release WordPress.org
- Dialog (Modal) Pattern W3C WAI
- Carousel Jetpack
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


