You are currently viewing How To Link An Image Or Media File In WordPress

How To Link An Image Or Media File In WordPress

WordPress how to link an image

Creating links is one of the most fundamental features of the World Wide Web (now, what we simply call the Internet). The ability to “hyperlink” or jump from page to page is what made the web so easy to navigate. Otherwise, we would have to rely on search engines or type the URL in the address bar of our browsers everytime we wanted to visit a website.

Creating a hyperlink in text is easy. In HTML, just surround the word(s) with an “a href” tag and put the URL in quotes. For example:

<a href="https://mywebsite.com">Here is a link to My Website</a>

Creating a hyperlink from an image is the same concept. However, WordPress makes it easy. Instead of coding HTML, you just have to click on the chain link icon (after selecting the image) and insert the URL. See the screenshot for reference.

If we were to look at the HTML it would look like the below code. Notice, the text is replaced by a reference to the image file on the website. You can always view the HTML of a block by selecting the three dots and choosing Edit as HTML.

<a href="https://mywebsite.com"><img src="https://mywebsite.com/images/mywebsitelogo.jpg" /></a>

Also Read: WordPress: How To Add a Slideshow from a Gallery