Skip to content
GPLWP Guides

How to add a lightbox to images and videos on WordPress

Media & Galleries Time About 20–30 minutes 6 steps Updated 4 Sep 2026

MEDIA & GALLERIES
The short answer

WordPress includes a built-in lightbox for Image and Gallery blocks, but not for the Video block. Use “Enlarge on click” for images, and use a lightbox plugin or custom code when you need videos, mixed galleries, styling controls or reliable navigation.

The route
  1. 01Choose the media you need
  2. 02Enable the image lightbox
  3. 03Set up a gallery lightbox
  4. 04Add videos the right way
  5. 05Check links and conflicts
  6. 06Use a plugin for mixed media

What you need

  • A WordPress site with editor access
  • Images uploaded to the Media Library
  • Video files or supported video URLs
  • A staging site or recent backup for plugin changes

Choose the media you need

Decide whether you need an image lightbox, a gallery lightbox, a video lightbox, or one overlay that handles all three. WordPress’s core controls cover Image and Gallery blocks, while the Video block is designed for inline playback or embeds rather than a lightbox overlay.

If you only need visitors to enlarge photographs, the built-in option is usually enough. If you need videos, captions across mixed media, custom transitions, social sharing or more control over navigation, plan to use a plugin.

Enable the image lightbox

Edit the page or post and select an Image block. In the block toolbar or media settings, enable Enlarge on click. Publish or update the page, then click the image on the front end to confirm that it opens over the current page rather than taking visitors to an attachment page.

This is the manual route for a single image. It does not require another plugin, but the available design and media options are limited to what WordPress and your theme provide.

Set up a gallery lightbox

Select the Gallery block and add your images. In the gallery’s link settings, choose Enlarge on click, then review the navigation button setting if your WordPress version displays it. Visitors can move forwards and backwards through the gallery without leaving the page.

Do not choose None or an attachment-page link if you expect the native lightbox to open. Older tutorials may tell you to choose “Media File”, but the current block editor uses the dedicated enlarge option.

Add videos the right way

Insert a Video block for a video that should play within the page. WordPress lets you upload a file, choose one from the Media Library or insert a supported URL, but its standard Video block does not provide the same native lightbox control documented for images and galleries.

For a video overlay, add a lightbox plugin or build a custom front-end modal. A plugin is usually safer unless you are comfortable maintaining JavaScript, keyboard focus, closing behaviour, responsive sizing and video embeds yourself.

Check links and conflicts

Test every image and video on the published page, not only inside the editor. If an image opens as a separate file, check that it is not linked to an attachment page or set to no link. Some lightbox plugins require image links to point to the media file before they can recognise them.

If clicking does nothing, clear caching and check whether the lightbox’s JavaScript and styles are loading. Support threads commonly trace failures to missing plugin scripts, theme conflicts, block variations or one gallery having different link settings from another.

Use a plugin for mixed media

For the fast route, install and activate Meow Lightbox Pro, then configure its lightbox settings and apply it to your image, video and gallery content. It is the better fit when you need one responsive presentation layer, lazy loading, touch and keyboard navigation, or more control over gallery presentation.

Keep the native WordPress option if you only need enlarged images and galleries. Choose the plugin when videos and presentation controls are part of the requirement, then test the result on desktop, mobile and an incognito browser window.

The fast route

Let Meow Lightbox Pro do it

Responsive image, video, and gallery lightboxes with lazy loading; choose it when presentation and navigation matter most.

Get Meow Lightbox Pro

Sources

  1. wordpress.org /documentation/article/gallery-block/?utm_source=openai
  2. wordpress.org /documentation/article/image-block/?utm_source=openai
  3. wordpress.org /documentation/article/video-block/?utm_source=openai
  4. wordpress.org /plugins/gallery-block-lightbox/?utm_source=openai
  5. wordpress.org /support/plugin/gallery-block-lightbox/?utm_source=openai

Questions

Does WordPress have a built-in image lightbox?
Yes. WordPress includes an “Enlarge on click” option for Image and Gallery blocks. Select the block in the editor, enable that option, and test the published page. It opens the image in an overlay without sending visitors to another page. The built-in feature is suitable for straightforward images and galleries, but it does not provide the same video and styling controls as a dedicated lightbox plugin.
Can the WordPress Video block open in a lightbox?
Not with the standard Video block alone. The core Video block inserts an inline player or supported embed, while WordPress documents its native lightbox control for Image and Gallery blocks. To open videos in an overlay, use a plugin that supports video lightboxes or add and maintain custom modal code.
Why does my image open on another page instead of in a lightbox?
The image is usually linked to an attachment page, the original file without a lightbox handler, or no link at all. Select the Image or Gallery block and use “Enlarge on click” for WordPress’s native lightbox. If you use a third-party plugin, check its documentation because some plugins require links to point specifically to the media file.
Why does a lightbox work on one gallery but not another?
A lightbox can fail on one gallery when that block has different link settings, the required scripts are not loaded, or the theme, cache or another plugin interferes with the front-end JavaScript. Compare the working and broken blocks, confirm their image links and clear caches. Test the published page, because the editor preview does not always show the final behaviour.