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.
How to add a link to an existing image
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:
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.
Click it and select the Custom URL option. You’ll then be given an input where you can add any URL.
Update the image and save the page/post, and the image will now link to the new URL.
How to link an image as you insert it
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.
You can add the link while inserting the image this way instead of opening up the image details window afterward.
How to remove the default link
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.
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.