Force File Download in WordPress

While working on providing users who subscribe to our newsletter with free downloads of our hand drawn arrows from our post called Add Call to Action Arrows on a Button, we realized that we have never needed to do this. So, we created a free plugin that makes this a piece of cake.

This plugin is called Simple Downloads and makes it simple, easy, and safe to create download links on your WordPress website. You can associate these download links with any file in your media library and when a download link is clicked on, the file will download to your user’s computer instantly. Click on the button below to get a free download of our Simple Downloads plugin. Subscribing allows us to notify you of any updates that we make to the plugin as well as any other WordPress resources that we think could be useful. We won’t spam you, ever!

Subscribe to Get a Free Download of Simple Downloads Plugin

Now that you have subscribed and received an email containing our free Simple Downloads WordPress plugin, follow the 3 simple steps below to start creating download links on your WordPress site.

Step 1: Install and Activate Simple Downloads

Hover over Plugins in the left sidebar and click on Add New

Click on the Upload Plugin Button.

Select the simple-downloads.zip file that you downloaded from the email that you received after subscribing

Click on the Activate Plugin button

Now that you have downloaded, installed, and activated Simple Downloads, you have just two steps left to allow your customers to start downloading files from your WordPress site.

Step 2: Upload a File

Hover over Media and Click Add New

Click on Select Files and Select the File that You want to Upload

Click on the Edit link after the File has successfully uploaded

Step 3: Create Your First Simple Downloads Link

To create a download link, you first need to get the link to the file that you want your users to be able to download. Hover over Media Library in the left sidebar and click on Library to go to your media library.

Then, you’ll see the page below. Click on the file that you want to allow your users to download.

Now, you need to allow the media file to be downloaded. This is a security mechanism that prevents users from downloading any of your media files without your consent. To do this, you need to scroll down to the bottom of the media edit page and change the Allow Download select input to Yes. Then, you need to save the Media file so that your selection is saved.

Then, copy the File URL that appears on the right side of your edit screen.

Next, go to the page where you want to add your Download link and add the following shortcode:

[simple_downloads url="https://www.yourwordpresssite.com/wp-content/uploads/2018/03/image.png"]Example Link[/simple_downloads]

If you would like to edit the link’s class, style, and title attributes you can do that by adding those parameters to the shortcode, see below for an example.

[simple_downloads url="https://www.yourwordpresssite.com/wp-content/uploads/2018/03/image.png" style="color:#000000;" class="btn btn-primary" title="Download"]DOWNLOAD[/simple_downloads]

If you would rather just get the link to use in an email, hover over Media and click on Library. Then, click on a file that you would like to get a download link to. Look at your browser’s URL field. Copy the value next to post= in the browser’s URL. In the following case, the value that we’re looking for is 5607.

Then, you need to add a wp_download_id query string variable to the end of your WordPress website’s domain name and set it equal to the Post Id that you copied above. The URL below shows an example of this:

http://yourwordpresswebsite.com?simple_downloads_id=5607
http://yourwordpresswebsite.com?simple_downloads_id=YOUR_FILE_ID

Leave a Reply

Your email address will not be published. Required fields are marked *