How to Link an Image to Any URL in WordPress

Disclosure: This post may contain affiliate links. Purchasing a product through one of these links generates a commission for us at no additional expense to you.

You can link images in your posts and pages to any URL. And with WordPress, it’s easy to do.

In this tutorial, you’ll learn how to link existing images to a custom URL, and how to add links to new images as you insert them in a post/page.

First, visit the edit screen for the post/page with an image you want to add a link to. Next, click the image in the editor, and you’ll see the following toolbar:

image editing toolbar

See the pencil icon? That button will open the Image Details window. Click it now to open the window.

In the Image Details window, there’s a Link To option in the Display Settings section.

the Link To image setting

Click it and select the Custom URL option. You’ll then be given an input where you can add any URL.

URL input for custom URLs

Update the image and save the page/post, and the image will now link to the new URL.

This will save you some time.

You’re probably familiar with the Insert Media window that displays when adding new media to a post. In the bottom-right corner, there’s the same Link to option.

Link To option in the Insert Media window
Look familiar?

You can add the link while inserting the image this way instead of opening up the image details window afterward.

Images always link to their attachment page by default. This is pretty much pointless because the attachment page just displays the same image, and usually not even at a larger size!

We published a tutorial on how to turn off image links by default, and you’ll find it helpful if you also hate the default attachment links.

Conclusion

Now you know how to easily add links to any of your images. To save time, you can use the display settings in the Insert Media window to add links as you insert images.

If you have any questions about adding links to images with WordPress, post a comment below.

Ben Sibley
Ben Sibley
Ben Sibley is a WordPress theme designer & developer, and founder of Compete Themes.