Do you want to add custom links to gallery images in WordPress?
Custom links can point to any specific page or post on your site or even to an external site. However, when creating a gallery, your choices are either to link the image to the attachment page or the media file.
In this article, we will show you how to add custom links to gallery images in WordPress.
Why Add Links to Gallery Images in WordPress?
Gallery images are a great way to improve the user experience of your website. You can show a collection of images about your products, features, and other benefits to users.
Adding custom links to your gallery images helps direct users to another page or post on your WordPress website. This helps in keeping your visitors engaged and increasing their stay time.
For example, if you have multiple product images in a gallery, then you can link to the product page. Similarly, you can also add affiliate links or an external link to your image gallery to make more money.
However, WordPress doesn’t let you add links to image galleries by default. You can only link individual images to an attachment page or a media file.
That said, let’s look at how you can easily link your gallery images in WordPress.
Adding Custom Links to Gallery Images
To add gallery custom links functionality to gallery images in WordPress, the first thing you need to do is install and activate the Gallery Custom Links plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
This free WordPress plugin lets you add custom links to your gallery images. It works out of the box, so there are no settings for you to configure.
Simply go to a post or page and create a new gallery. You will see the custom link meta fields for individual images in the gallery.
You can link an image in the gallery to any post, page, or even an external website. You can also choose whether you would like the link to open in the same or a new window.
The plugin works very well with any other plugins you may be using to display images in a lightbox popup or carousel. It also allows you to keep or disable onclick events for an individual picture in the gallery.
Adding Custom Links to Single Images
Now, let us also look at how to add a custom link to a single image in WordPress.
To start, simply upload your image file using the media uploader. You can also add an image block in the WordPress Block editor and upload the image.
Once you’ve uploaded the image, you can link it to a custom URL under attachment display settings. Simply select the image and then click the ‘Insert Link’ icon.
After that, you can enter a custom URL or select a Media File or an Attachment Page to link the image.