How To Add A Custom URL To WordPress Gallery Images

How To Add A Custom URL To WordPress Gallery Images


When we add an image to our page, or post, we can indicate a url to point to when someone clicks on the image.

This is a trick used since the world is world and since the internet began to work.

Many times it is easier to add a url to an image so that the visitor to our page visits a url that we want, than a link, that can go unnoticed.

WordPress also gave us the opportunity to add a gallery of images, but that is where the doubt arises.

Can we add custom links to individual images within a gallery? Yes, we are going to show how it can be done.

Custom Links To Gallery Images

The first thing we are going to do is ask for help from one of our great friends, the plugins.

In this case, the plugin that we are going to install is Gallery Custom Links, which will facilitate the task. It is also a free plugin, easy to use.

This WordPress plugin will allow us to add custom links to the images in our gallery.

As we have said, it is easy to use, because we don’t really need to configure it.

The only thing we have to do is create a page or post, and create a gallery, we can see the metafields of custom links for individual images in the gallery.

Custom Links To Gallery Images

As we can see in the image, we can link an image from the gallery to any url, we can also choose how we want that link to be.

Custom Links To Single Images

To add a link to a single image in WordPress, we just have to add an image to our page or post, on the right side, in Attachment Display Ssttings – Link To, we will choose Custom URL.

Custom Links To Single Images

A new URL field will appear, where we will put the link of the page we want to open.



If you have not created your website yet, you may be interested Create Your Website With WordPress.

Custom Links in the Block Editor

The steps above use the classic Attachment Display Settings panel. In recent versions of WordPress you can also do this with blocks: select the image (or an individual image inside a Gallery block), click the link icon in the block toolbar and paste the URL. The link icon lets you choose whether the link opens in a new tab.

Which Option Should You Use?

  • One image with one link: add the link directly to the image, as explained in the single image section.
  • A gallery where each photo links somewhere different: use the Gallery Custom Links plugin or the link option of each image in the Gallery block.
  • A gallery that opens the images larger: choose Link to Media File instead of a custom URL.

Tips for Linking Images

  • Add a clear alt text to every linked image. It describes the image for people using screen readers and helps search engines understand where the link leads.
  • If the link opens another website, choose to open it in a new tab so visitors do not leave yours.
  • Do not rely on an image link alone. If the link is important, add a short text link near it too.
  • Check on mobile that the linked images are large enough to tap easily.

Building a portfolio? Browse our WordPress themes for photographers. You may also like: Before and After Photo in WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Shares
Share This