This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

This plugin has been closed and is no longer available for download.

Download Shortcode


Have you ever linked a PDF, an mp3, image, or other kind of file because you wanted to let people download it but instead it just loads in the browser? This plugin introduces a [download] shortcode which allows you to output links that will tell the browser to download those files!


WITH ‘pretty permalinks’ enabled in Settings > Permalinks:

The following example would display as:

  • A link titled My Link
  • With a rewritten URL of

    [download label=”My Link”][/download]

The following example would display as:

  • A rewritten link titled


WITHOUT ‘pretty permalinks’ enabled in Settings > Permalinks:

The following example would display as:

  • A link titled My Other Link
  • With an exposed URL of

    [download label=”My Other Link”][/download]

The following example would display as:

  • An exposed link titled


Other Uses

If you wanted to use this in a php template, you could call something like:

<?php echo do_shortcode( '[download label="My Label"][/download]' ); ?>

Important notes:

  1. If your server permissions allow it, the plugin will automatically attempt to copy force-download.php to your /wp-content/ directory.
  2. If your server permissions DO NOT allow it, you will need to manually upload the file located in /download-shortcode/wp-content/force-download.php to your /wp-content/ directory.
  3. By default, forced-download links only support files located in your uploads directory. More about this in Other Notes.


  1. Upload the entire download-shortcode folder to the /wp-content/plugins/ directory
  2. The plugin will automatically attempt to copy force-download.php into your /wp-content/ folder, though you may need to upload it manually if your server lacks the necessary permissions.
  3. Activate the plugin through the ‘Plugins’ menu in the Dashboard.


Which file formats does this work with?

Currently, this plugin can force downloads for pdf, mp4, mp3, gif, png, jpg and jpeg files

When I click links from the front-end, all I get is a 404 Page Not Found error or a white screen. What gives?

There are two things you should check:
* There may be a problem with the force-download.php script located in your /wp-content/ directory. Try copying the force-download.php file from download-shortcode/inc/force-download.php to your wp-content directory.
* It is also possible you just need to flush your rewrite rules by visiting the Settings > Permalinks screen in your Dashboard.

How can I modify this plugin’s default behavior?

Check out the Other Notes section for example functions and filters.

I’ve uninstalled Download Shortcode but now I have a bunch of broken shortcodes in my posts and pages. How can I hide them?

You can add the following function to your theme’s functions.php file to hide all instances of the [download] shortcode in your content.

function hide_download_shortcodes( $attr, $content ) {
add_shortcode( 'download', 'hide_download_shortcodes' );

Contributors & Developers

“Download Shortcode” is open source software. The following people have contributed to this plugin.


Translate “Download Shortcode” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Add support for WordPress in a subdirectory
  • Regenerate pot file to include translatable strings
  • TODO: Add Multisite upload directory support


  • Complete plugin rewrite
  • Introduce URL rewriting if ‘pretty permalinks’ are enabled
  • Add logic to make overwriting/updating/removing force-download.php more automated
  • Add fds_rewrite_urls filter to allow disabling URL rewriting
  • Add fds_download_rewrite_path filter to allow changing the rewrite endpoint
  • Add fds_upload_rewrite_path filter to allow changing the supported directory
  • Make the plugin translatable


  • Update readme.txt with note about replacing force-download.php in wp-content with the new one


  • Remove faulty strlen check on filenames in force-download.php
  • Fixes for WSOD issues.


  • Fix security vulnerability which exposed php core files to direct download
  • Adds phpDoc blocks
  • Add fds_download_link_class filter to change download link class
  • Other minor tweaks


  • Initial release