Gallery Custom Links allows you to link images from galleries to a specified URL. Tested with WordPress Gallery, Gutenberg, the Meow Gallery and others.

Usage

Two fields are added to your images, in your Media Library: Link URL and Link Target. If, at least, the Link URL is set up, this image will link to that URL every time it is used within a gallery. Lightbox will be automatically disabled for those images.

Compatibility

It currently works with the native WP Gallery, the Gutenberg Gallery and the Meow Gallery. It should actually work with any gallery plugin using the ‘gallery’ class and Responsive Images (src-set).

Filters

You can optimize (run the plugin only on the pages where you need it) and support more galleries (through CSS classes) easily by using filters.