Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/paradonk/documents-download/archive/refs/heads/main.zipA WordPress plugin for uploading downloadable documents (brochures, spec sheets, etc.), categorising them, and letting site visitors download them directly via a shortcode.
Features
- Custom post type (
cd_download) for managing downloads, listed in the admin menu as Products. - Three hierarchical taxonomies: Document Types, Languages, and Product Categories.
wp.mediauploader metabox for attaching a file to each download.- Admin list table with taxonomy filter dropdowns.
[documents_download]shortcode rendering a table of all published downloads with a one-click download link.- Force-download handler that validates post type, publish status, and file
existence before streaming the file with
Content-Disposition: attachment.
Installation
- Copy the
documents-downloadfolder to/wp-content/plugins/. - Activate the plugin through the Plugins menu in WordPress.
- Go to Products > Add New, give it a title, and upload a file via the Download File metabox.
- Assign Document Type / Language / Product Category terms as needed.
- Add the
[documents_download]shortcode to any page or post to display the downloads table.
Shortcode usage
[documents_download]
Shows all published downloads in a table (public).
[documents_download require_login="1"]
Hides the table from visitors who aren't logged in.
Note:
require_loginonly controls whether the table/links are displayed. The direct-download URL (?direct_download=1&file_id=N) is not itself access-restricted, so don't rely on this attribute to protect files that must stay private — it's intended for openly downloadable material like public brochures.
How downloads work
Each download link points to:
/?direct_download=1&file_id=<post_id>
On init, CD_Download_Handler checks that the post exists, is of type
cd_download, is published, and has a valid attached file, then streams it
directly rather than exposing the underlying uploads-folder URL.
File structure
documents-download/
├── documents-download.php # Plugin bootstrap
├── assets/
│ ├── css/admin.css
│ ├── css/frontend.css
│ └── js/admin-uploader.js # wp.media integration for the metabox
└── includes/
├── class-cd-cpt.php # Post type + taxonomies
├── class-cd-metabox.php # File upload metabox
├── class-cd-admin-list.php # Admin list columns & taxonomy filters
├── class-cd-shortcode.php # [documents_download] shortcode
└── class-cd-download-handler.php # Force-download handler
Requirements
- WordPress 5.6+
- PHP 7.4+
License
GPLv2 or later.