Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Add Custom Links to Gallery Images in WordPress

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.

Add custom links to gallery images

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.

Custom gallery links

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.

Add image block

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.

Link a single image

We hope this article helped you add custom links to gallery images in WordPress. You can also check out our guide on how to fix common image issues in WordPress and the best web design software.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

52 CommentsLeave a Reply

  1. This post is really helpful. It just helped me beyond my thoughts, I even think that it’s impossible to do this and no one has a post about this. Thanks very much

  2. I came across this tutorial. It seems that the recomended plug-in “WP Gallery Custom Links ” is deactivated since Jan 2019. I found a working replacement for that: “Gallery Custom Links” (without “WP” in the name) that works in my WP 5.0 installation

    • Thank you for letting us know about this plugin as we look into updating this article :)


  3. Can someone explain how to get Gallery Custom Links to work? I installed and activated it but when I went to my gallery I didn’t have any custom link meta fields out of the box like the one in the example.

    • You would want to go to the plugin’s page and post on their support forum and the plugin’s support should be able to assist you :)


  4. I love WP beginner and find it very useful. However, it seems your solution to literally everything is to install a plugin. If I was to follow your advice, I’d have about a million plugins by now to achieve simple tasks. It’s actually frustrating, every articles solution is to install a plugin.

  5. Hi, just a quick update on users looking to install the plugin mentioned here: it looks like it is not up-to-date with the latest versions of WP, according to recent reviews on the plugin page “WP Gallery Custom Links” :S

  6. Thank you so much for this! I had been looking at installing all sorts of new galleries and none of them were what I was looking for. This was the perfect solution.

    Now I’d be interested if it would also work with a carousel gallery, so they can get a closeup of the image and then click on that to a link.

    Either way your plugin is awesome and much appreciated!!!

  7. This plugin is not being updated, and the author doesn’t seem keen to do anything about it, not to help its users. The plugin only works with the standard gallery, doesn’t work with any other even the new Gallery Block brought by WordPress 5.0.

    I proposed to help but was ignored. I developed my own, which worked with most galleries, and much cleaner/faster than this one. Please have a look: Gallery Custom Links and if any issue, let me know. I will make it work :)

  8. Hi! thank you for your post. I installed it and can’t get any of the images in my gallery to be clickable. I’ve been playing around with it and trying different options but no luck. Some help please? :)

  9. Thanks for this article. I wasted so much time looking at all of these carousel plugins that did so many complex, Java-driven things when all I wanted was the functionality this one gives you.

  10. I really like the WP Gallery Custom Links but I want to take off the part of COMMENTS. I just want a link of my photos and the explanation …nothing more. How can I take off the COMMENTS PART?

  11. Do you have any idea just how much time and energy and effort you saved me? I should have looked here first, but hey, I found just what I needed. By the way, this is working just fine with the WP Image Gallery. Also, support for this plugin is being maintained now by “johnogg” and seems like he’s doing a top notch job! Thank you so very much for this tutorial/post. You guys are awesome! Ed McCarthy

  12. Does this plugin still work?
    I installed it and can’t get any of the images in my gallery to be clickable. I’ve been playing around with it and trying different options but no luck. It would be a brilliant plugin if I could get it to work..


    • Nevermind. I finally got it working when I switched the general setting to link to “media file”.

      • Could you explain how you switched to “media file” because I do not see this option. Currently my photos (when clicked) are just enlarging the photo itself, and the link seems almost nonexistent

  13. I want have uploaded an image in my site which ontain a link I want to made that link no follow but i click on the no follow button its says no hyperlink. What should I do

  14. I had the same problem as ‘K’ (who posted on Jun 6, 2015 at 12:53 pm) – took a while to workout but you need the full address (including http:// ) to get external links to work correctly.

    Very helpful pluggin.

  15. When I type in the url I would like the image to link to everything works except the URL of the linked page just gets tagged to the end of MY pages URL and therefore gets a mistake message saying that the url doesnt exist (because it’s now two URLs stacked) Please help! Would love this to work!

  16. Will this enable me to post an image on Facebook so that when people click on the image it takes them to a post in WordPress?

  17. Nice Info. How can we wrap text around the images without corners of the images protruding out of the text alignment ? Is it the width of the page or something to do with the style. ?

  18. Are there any tutorials on how to use this plug in with the newest version of WP? I’ve been happily using it for nearly a year but since upgrading I haven’t been able to figure it out and can’t find much help on how to do it.

  19. Hi there i am using this plugin. can you tell me that how can i set all images size same whatever i want set the size of all the images of my gallery. here is my website

    please see all the images size. i want to keep all the images size same. can you help me with that if you can please reply. i would really appreciate your help. thanks

  20. Great timing as I was just finally getting to wanting to add links to images in a client gallery.
    Thank you!

  21. Thanks for the info! Do you know if there’s any way to make the WP gallery links “nofollow”?

    • This is not possible at this moment without editing the plugin itself, which we do not recommend. However if you feel comfortable creating your own plugins then you can fork the plugin and modify it to match your needs.


Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.