New for version 0.2, the plugin will now also add the lightbox attribute and caption to image linked galleries using the [gallery link=”file”] shortcode.


add-rel-lightbox is a WordPress plugin that will automatically add a rel=”lightbox” attribute and the image appropriate description from the media library to link-wrapped images placed in WordPress posts.

Previously, the plugin only worked with images placed into posts of the exact format used by the “add media” dialogues, and only for images that are in your media library. This means it will not interfere with any images that have already added attributes to.

New for version 0.2, the plugin will now also add the lightbox attribute and caption to image linked galleries using the [gallery link=”file”] shortcode.

In addition to the add-rel-lightbox plugin, to work properly, lighbox (or a lightbox clone such as slimbox) must be active on your site. This can be either as part of your theme, or included as a plugin. If at any time, either component is not activated, the site will revert gracefully to the standard function of “open image as new page”.

So with the plugin activated and your lightbox clone active, using

[gallery link="file"]

in your post will give:

image Caption

gallery code image Uses replacement [gallery] shortcode

attachment parsing Parses the attachment link to add attributes


Plugin available at the Wordpress Plugin Directory or search for “add-rel-lightbox” in the Plugins -> Add New page of your site administration.

Code is available for play with, adjust, fork and modify at GitHub.com/DefProc/add-rel-lightbox, improvements are accepted.