How To Add A Download Link In WordPress (Step-by-Step)

If you are writing a blog post and want to give a downloadable PDF file or any useful downloadable file, you will probably need a download link in wordpress.

But the question is how to add a download link in wordpress? In this guide, you will learn how to add a download link and style it and make it attractive to let the user find it easily.

This method can be used anywhere on your wordpress website like you can use it on your post, page, widgets and menus.

So read the article until the end to better understand. Let’s dive into creating a download link in wordpress.

If you prefer watching videos over reading, you can watch the video below. The same steps are mentioned in the video. Else you can continue reading.

Add A Download Link In WordPress

The first thing you will need when adding download link is the URL pointing to the file that will be downloaded.

Step 1) Get the Download File URL

If the file you want to be downloaded by your user is hosted somewhere else online, you can use that URL.

But if it is not hosted somewhere else, you will have to upload it to your WordPress media library of wordpress.

You might be thinking that the media library is only for images, but it’s not the case. You can use your wordpress media library for videos, audio files (MP3s), and PDfs.

Go to your Media library by navigating to Media library > Add New to upload the file. Click on Select Files or drag the file from your PC to the area in the dotted rectangle to upload it.

media file in wordpress

Once the file is uploaded, you will now see an edit link. Click on it, and it will open a media edit page where you can update delete and see file info.

edit media file in wordpress

Locate the File URL box and triple-click on it to select the file URL, and you are done with getting the Download File Url.

copy the media file url

In the next step, we will add the copied link in our post.

Step 2) Add Download File Link on your Post

If you are a regular user of wordpress, then I am sure you have added tons of external or internal links to your posts and pages.

The same process is done while creating a link for a downloaded file but is slightly different.

Once you select the text for the downloaded file, for example, “Download me”, you will have a menu bar having different options to apply to the selected text.

Add Download File Link on your Post

Click on the link option, paste the URL we copied in step 1, and press enter.

Doing so will add a normal link that will redirect the user to the media file, but we have to make it automatically downloadable.

The normal way of adding links has its benefits, like having a PDF file in the link. You can add a message below it to right-click and choose the save link option or view it on the browser.

So now we will learn how to make the file download when the user clicks the link.

How to make the file download automatically

WordPress doesn’t have the option to download the file automatically but don’t worry. We can get this feature with a simple HTML editor.

edit as html in wordpress

First, you have to select the block where you download the link is and then click on 3 dots in the options menu. Select the “Edit as HTML” from it.

html block edit

Now you will have the HTML of the block here “p” represent paragraph tag and “a” represent link element, but you don’t have to understand anything. You have to put the download attribute into the link element like this.

automatically download file html code

Write “download= “image”” after the <p> tag as shown in the image above. But instead of writing an image, you have to write the download file name, which you can find by going to your media library to edit the file, and there you will a file name as shown in the image below.

make the file download automatically

For example, you have a file named income report.you have to write like this income-report. So, when someone clicks on the link, it will automatically download the file named income-report.pdf.

Once you are done, click on the 3 dots again and choose edit visually. It will return the paragraph to its normal presentation look.

The link will seem normal download link, but now if someone clicks on it instead of redirecting the user to the file, it will automatically download the file.

#image file download automatically

Using this method, you can add as many download links as you want. Now that you are familiar with the Plain HTML, you can also use the same method in your custom HTML widget to put the automatically downloaded file in the website’s sidebar.

But for, the menu cannot edit plain HTML directly, so if you want to add a download link, you have to use a URL pointing to a zip file to initiate an automatic download.

You May Like :

How to Create Table in WordPress Without Plugin

How to Change Link Color in WordPress

How to Disable Comments in WordPress

How to Create a Download Button

Well, the button does the same job as the download link, but it look clean and nice and a lot of people used it to download files.

To use the button to download the file, all you have to do is add the button block by typing “/button” or selecting the button block from the Gutenberg block editor.

Create a Download Button in wordpress

Now edit the HTML as we did in the download link, and you are done.

Wrapping it Up

Adding download links and a download button is simple even if you link to zip files, PDF, or any other wordpress supported files.

With the knowledge given in this article, you can now create a download link and attractive download button to share the resources with your website visitors.

If you are still confused about how to add download links in wordpress, you can ask via comments, and we will be happy to help you out.

Leave a Comment