How to Add a Download Link in WordPress
Anything on the internet has a unique address which the internet user can use in order to reach the content that they like. Typically, we think of pages or posts as having URLs, but that’s not the whole story. WordPress media files have URLs, too. You might want to make these media files available to your visitors irrespective of the rest of your content; regardless of how they are used on the website – if at all. This is what we are talking about when we speak of adding a download link in WordPress. And this is what we’ll be talking to you about.
First things first: what is a download link in WordPress? The clue is very much in the name: it is a link clicking which will allow your visitor to access a file. Typically, it’ll be something like a .pdf, an eBook, video, or some other file not meant for use on the website, but there’s nothing stopping you from adding download links for everything in your media library. Anything in your media library has its own URL.
You can find this URL by accessing your media library. We will be using a .pdf file for this demonstration, but it works much the same with any file format. Hovering over the file will reveal the Edit, Delete Permanently, View, and Copy URL to clipboard links. You can copy it by clicking the last link, while clicking the Edit link will take you to the Edit Media page.
The file URL will be in the upper right hand side panel, where you can see what it is, and, again, copy it by clicking the Copy URL to clipboard button.
Entering that link into your browser’s URL field and hitting Enter will either display the file as an image, if applicable, or initiate a download. You can add download links to your pages or posts, too. Find out how in the tutorial sections below.
We will show you how to add a download link to a WordPress post using the Gutenberg page editor. Adding a download link to a page works exactly the same. We’ve begun by creating a new post and giving it a title.
To add a download link, click the + icon, find a File block and select it.
You can now upload a file or select one from your media library. We will add the .pdf file we were using in the previous section.
You can see the block settings on the right. The Show inline embed control lets you toggle the preview, while the Height in pixels slider lets you set the preview window’s height in pixels. The block can Link to a media file or a page the file is on, and can be set to Open in the new tab. Finally, you can toggle the Download button using the Show download button setting.
In case you are using Elementor as your page editor, the process works a little differently, but it is nonetheless simple enough. For this demonstration, we will be using a button, but you can use any widget with a link field.
Begin by selecting a button widget from the left hand side menu and dragging it to where you want it on the page.
You can now edit the button as you would any other widget. However, the settings we are interested in are the Link settings. Paste the link to your file in the link field, and click the Gear button to open the advanced link settings.
Then, check the Open in new window box, optionally check the Add nofollow box in case you want to create a nofollow link, and enter download into the Custom Attributes field.
And there you have it, your download link is fully operational.
Wrapping It Up
As you can see, adding download links in WordPress is easy and quick irrespective of the page editor you are using. If you have a use for this functionality on your WordPress website, now you know how to do it.
We hope this article was helpful. If you liked it, feel free to check out some of these articles as well!