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/bizbudding/wampum-protected-media/archive/refs/heads/master.zip<<<<<<< Updated upstream
Protected PDFs
<<<<<<< HEAD Attach PDFs to pages/posts/cpts that can only be viewed from the pages they are attached to (via PDF.js). Requires Genesis for file display and ACF Pro for the files metabox.
Attach PDFs to pages/posts/cpts that can only be viewed from the pages they are attached to. Requires Genesis for file display and ACF Pro for the files metabox.
da3eeae (initial commit to get back up and running)
Wampum - Protected Media
Attach PDFs and other files to pages/posts/cpts that can only be viewed from the pages they are attached to. Files are protected with time-limited tokens and cannot be directly accessed or indexed by search engines. Requires Genesis for file display and ACF Pro for the files metabox. Stashed changes
Features
- Time-limited token-based protection (default: 2 hours)
- Prevents direct file access
- Prevents Google indexing with
X-Robots-Tag: noindexheader - PDFs display inline in browser
- Other files download automatically
Nginx Configuration
To prevent direct access to protected files, add the following location block to your Nginx server configuration:
# Block direct access to protected uploads directory
location ~* /wp-content/uploads/wampum_protected_uploads/ {
deny all;
return 404;
}
This ensures that files can only be accessed through the protected download handler with valid tokens.
Adding to Nginx Config
- Open your Nginx configuration file (usually
/etc/nginx/sites-available/your-siteor/etc/nginx/nginx.conf) - Add the location block above within your
serverblock - Test the configuration:
sudo nginx -t - Reload Nginx:
sudo systemctl reload nginxorsudo service nginx reload
Filters
wampum_protected_media_post_types
Filter which post types support Protected Media.
add_filter( 'wampum_protected_media_post_types', function( $post_types ) {
// Add or remove post types
return $post_types;
} );
wampum_protected_media_image_size
Change the image size used for display.
add_filter( 'wampum_protected_media_image_size', function( $image_size ) {
return 'medium'; // or 'thumbnail', 'large', etc.
} );
wampum_protected_media_token_expiration
Change the token expiration time (default: 2 hours).
add_filter( 'wampum_protected_media_token_expiration', function( $seconds ) {
return 3 * HOUR_IN_SECONDS; // 3 hours
} );
wampum_protected_media_download_headers
Customize headers when serving files.
add_filter( 'wampum_protected_media_download_headers', function( $headers, $file_id, $is_pdf ) {
// Modify headers array
return $headers;
}, 10, 3 );Releases
1 release.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.