Title: PTP Private Media
Author: Umang Prajapati
Published: <strong>18 Giugno 2026</strong>
Last modified: 3 Novembre 2026

---

Ricerca i plugin

![](https://ps.w.org/ptp-private-media/assets/banner-772x250.png?rev=3579966)

![](https://ps.w.org/ptp-private-media/assets/icon-256x256.png?rev=3577693)

# PTP Private Media

 Di [Umang Prajapati](https://profiles.wordpress.org/umangapps48/)

[Scarica](https://downloads.wordpress.org/plugin/ptp-private-media.1.2.0.zip)

 * [Dettagli](https://it.wordpress.org/plugins/ptp-private-media/#description)
 * [Recensioni](https://it.wordpress.org/plugins/ptp-private-media/#reviews)
 *  [Installazione](https://it.wordpress.org/plugins/ptp-private-media/#installation)
 * [Sviluppo](https://it.wordpress.org/plugins/ptp-private-media/#developers)

 [Supporto](https://wordpress.org/support/plugin/ptp-private-media/)

## Descrizione

**PTP Private Media** gives you full control over who can access your WordPress 
media files. Stop search engines, bots, and unauthorised visitors from downloading
your protected images, PDFs, videos, or documents.

**Author:** [Umang Prajapati](https://phptutorialpoints.in/) | [WordPress Profile](https://profiles.wordpress.org/umangapps48/)
| [GitHub](https://github.com/umang48/secure-media-vault)

#### Core Features

**🔐 Media Protection System**
 * Prevent direct URL access to files in `/wp-content/
uploads/` * Files are served through a secure PHP handler, not exposed directly *
Automatic `.htaccess` rules block direct file access on Apache servers * Guidance
provided for Nginx configurations

**👥 Fine-Grained Access Control**
 Set a protection level for every file in the
Media Library:

 * **Public** – standard WordPress behaviour
 * **Logged-in users only** – any authenticated user
 * **Specific roles** – choose from all registered WordPress roles (Admin, Editor,
   Subscriber, etc.)
 * **Password protected** – custom password per file
 * **Restrict to posts/pages** – only accessible when referred from specific content

**🔗 Secure File Delivery**
 * Replace original media URLs with HMAC-signed, time-
limited token URLs * Format: `example.com/ptp-restricted-media/{file-id}/{token}/`*
Configurable token expiry (default: 1 hour) * Hotlink protection prevents embedding
on external domains * Optional IP-address binding for tokens

**🚫 SEO & Indexing Protection**
 * `X-Robots-Tag: noindex, nofollow` header on 
all protected file requests * Optional `Disallow` entries in `robots.txt` for the
uploads directory * Disable and redirect WordPress media attachment pages * wp_robots
API integration for attachment pages

**📂 Media Library Integration**
 * Protection Settings panel on every attachment
edit screen * Protection status column (`Protected / Public / Password / Role`) 
in list view * Bulk Actions: protect multiple files, change access rules, make public

**⚡ Performance**
 * Chunked streaming with HTTP Range support for large video/
audio files * Configurable file-size threshold for streaming vs. single-pass delivery*
Object cache support with cache invalidation on settings change * Scheduled cleanup
of expired tokens and old access logs

**🛡️ Security**
 * HMAC-SHA256 signed tokens using WordPress secret keys * Nonce
verification on all AJAX requests and form actions * All input sanitized and output
escaped per WordPress standards * No direct file inclusion; `ABSPATH` check on every
file * Clean uninstall via `uninstall.php`

#### Nginx Support

While `.htaccess` rules are written automatically for Apache, the plugin provides
the correct Nginx configuration block in the admin dashboard for manual setup.

#### WooCommerce Compatibility

The access control system is designed to work alongside WooCommerce. Future versions
will include native purchase-based access checks.

## Installazione

 1. Upload the `ptp-private-media` folder to `/wp-content/plugins/`.
 2. Activate the plugin through the **Plugins** screen.
 3. Visit **PTP Private Media  Settings** to configure your default options.
 4. Open any media file in the **Media Library** and set its protection level.
 5. If using Nginx, add the server block rules shown in the **Dashboard**.
 6. Re-save your **Permalink Settings** (`Settings → Permalinks`) if secure URLs return
    404.

## FAQ

### Will this break my existing media URLs?

Only files you explicitly protect will have their URLs replaced. Public files continue
to behave normally.

### Does it work with Nginx?

The PHP-level access control works on any web server. On Nginx, add the configuration
rules shown in the Dashboard to block direct file access at the server level.

### What happens if a token expires?

The user will receive an “Invalid or expired access token” message. Generate a new
secure URL from the Media Library.

### Can I use it with a CDN?

CDN bypass is possible for public files. For protected files, disable CDN caching
or ensure the CDN forwards requests to WordPress for validation.

### Does this affect site performance?

Large files are streamed in 1 MB chunks with HTTP Range support, so memory usage
stays low even for large videos.

### Will protected files still be indexed by Google?

No. The plugin sends `X-Robots-Tag: noindex, nofollow` on every protected-file response
and disables media attachment pages.

## Recensioni

![](https://secure.gravatar.com/avatar/b014db906d419ae67ef91ca9cd3a2ae2028421a2d98ff5bb215030ec85aab88c?
s=60&d=retro&r=g)

### 󠀁[Doesn’t work and Ai generated](https://wordpress.org/support/topic/doesnt-work-and-ai-generated/)󠁿

 [jacksonfreeze](https://profiles.wordpress.org/jacksonfreeze/) 12 Novembre 2026

I tried it and wasted time on this Plugin. It does not work, and does nothing in
the background. /uploads/FileXY are still available for everyone, even with the 
restriction turned on.I don't recommend, it also looks like Ai generated. At least
the Thumbnail is Ai for sure.

 [ Leggi la recensione di 1 ](https://wordpress.org/support/plugin/ptp-private-media/reviews/)

## Contributi e sviluppo

“PTP Private Media” è un software open source. Le persone che hanno contribuito 
allo sviluppo di questo plugin sono indicate di seguito.

Collaboratori

 *   [ Umang Prajapati ](https://profiles.wordpress.org/umangapps48/)

[Traduci “PTP Private Media” nella tua lingua.](https://translate.wordpress.org/projects/wp-plugins/ptp-private-media)

### Ti interessa lo sviluppo?

[Esplora il codice](https://plugins.trac.wordpress.org/browser/ptp-private-media/)
segui il [repository SVN](https://plugins.svn.wordpress.org/ptp-private-media/),
segui il [log delle modifiche](https://plugins.trac.wordpress.org/log/ptp-private-media/)
tramite [RSS](https://plugins.trac.wordpress.org/log/ptp-private-media/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.2.0

 * Compatibility: Tested with WordPress 7.1.4 and PHP 8.4.
 * Fix: Multi-role protection settings were silently dropped to a single role when
   saving from the Attachment Details dialog (media modal grid view). WordPress’s
   Backbone media model only serialises scalar custom fields, so checkbox arrays
   lost all but the last selected value. Roles are now JSON-encoded before posting
   and decoded server-side via a new dedicated AJAX endpoint (urma_save_protection),
   preserving every selected role correctly.
 * Fix: Protection settings edited in the Block editor “Open Media Library” panel
   were never saved. The panel had no save path to the server. A “Save Protection
   Settings” button is now injected into the Block editor media sidebar and uses
   the same urma_save_protection endpoint.
 * Fix: Block editor media panel did not pre-populate the current role selections
   when re-opening an attachment. The server now passes smvAllowedRoles, smvAllowedPostIds,
   smvHasPassword, and smvAllRoles through wp_prepare_attachment_for_js so the panel
   always reflects saved state.
 * Fix: Secure URL section (Generate / Copy / Revoke) was missing from the media
   modal popup (upload.php?item=ID) and the Block editor media sidebar. The section
   is now always rendered in the injected panel and shown/hidden dynamically based
   on the selected protection type without needing to visit the full attachment 
   edit page.
 * Fix: After saving protection settings from the media modal popup (upload.php?
   item=ID), the panel is now fully refreshed from the server via a new AJAX endpoint(
   urma_get_panel_html). The Secure URL section appears immediately after save without
   any manual page reload.
 * Fix: Rate limit on the secure URL generation AJAX endpoint raised from 30 to 
   120 requests per minute to prevent false “Too many requests” errors during normal
   admin use (e.g. opening multiple attachments in a media session).

#### 1.1.0

 * Compatibility: Requires PHP 8.0+ and WordPress 6.1+; tested with WordPress 7.1
   and PHP 8.4.
 * Fix: Access log retention cron (urma_cleanup_access_logs) was never scheduled–
   logs now auto-purge correctly based on the configured retention period.
 * Fix: Password form POST now verifies the nonce before processing the submitted
   password, preventing CSRF on password-protected files.
 * Fix: Generating secure URLs no longer inserts a new token row on every wp_get_attachment_url()
   call; tokens are cached per attachment+user for the request lifetime.
 * Fix: Token cleanup now uses wp_cache_flush_group() instead of the site-wide wp_cache_flush(),
   avoiding unnecessary cache eviction on persistent object caches.
 * Fix: Cron scheduling guard check moved from the Token Manager constructor to 
   the activator, eliminating a wp_next_scheduled() call on every single page load.
 * Fix: Variable name mismatch between render_logs_page() and the logs view template
   resolved.
 * Fix: get_edit_post_link() null return in the logs view is now handled safely 
   with an explicit cast.
 * Fix: Database schema uses BIGINT UNSIGNED without deprecated display-width specifier,
   compatible with MySQL 8.0.17+ and MariaDB.
 * Security: Session identifiers for anonymous password access now use cryptographically
   secure random_bytes(16) instead of md5().
 * Security: Added per-user rate limiting on the secure URL generation AJAX endpoint.
 * Improvement: Debug mode setting now writes to the PHP error log when both urma_debug_mode
   and WP_DEBUG are enabled.

#### 1.0.0

 * Initial release.
 * Media protection with `.htaccess` rules and Nginx guidance.
 * Per-file access control: public, logged-in, roles, password, posts.
 * HMAC-SHA256 signed, time-limited token URLs.
 * Hotlink protection and IP-binding option.
 * SEO protection: X-Robots-Tag, robots.txt rules, attachment page redirect.
 * Chunked file streaming with HTTP Range support.
 * Bulk protect/unprotect actions in the Media Library.
 * Access logging with configurable retention.
 * Clean uninstall removes all data.

## Meta

 *  Versione **1.2.0**
 *  Ultimo aggiornamento **2 settimane fa**
 *  Installazioni attive **20+**
 *  Versione WordPress ** 6.1 o superiore **
 *  Testato fino alla versione **7.1.4**
 *  Versione PHP ** 8.0 o superiore **
 *  Lingua
 * [English (US)](https://wordpress.org/plugins/ptp-private-media/)
 * Tag
 * [media library](https://it.wordpress.org/plugins/tags/media-library/)[media protection](https://it.wordpress.org/plugins/tags/media-protection/)
   [secure files](https://it.wordpress.org/plugins/tags/secure-files/)
 *  [Visualizzazione avanzata](https://it.wordpress.org/plugins/ptp-private-media/advanced/)

## Valutazioni

 1 su 5 stelle.

 *  [  0 recensioni a 5-stelle     ](https://wordpress.org/support/plugin/ptp-private-media/reviews/?filter=5)
 *  [  0 recensioni a 4-stelle     ](https://wordpress.org/support/plugin/ptp-private-media/reviews/?filter=4)
 *  [  0 recensioni a 3-stelle     ](https://wordpress.org/support/plugin/ptp-private-media/reviews/?filter=3)
 *  [  0 recensioni a 2-stelle     ](https://wordpress.org/support/plugin/ptp-private-media/reviews/?filter=2)
 *  [  1 1- recensioni a stelle     ](https://wordpress.org/support/plugin/ptp-private-media/reviews/?filter=1)

[La tua recensione](https://wordpress.org/support/plugin/ptp-private-media/reviews/#new-post)

[Vedi tutte le recensioni](https://wordpress.org/support/plugin/ptp-private-media/reviews/)

## Collaboratori

 *   [ Umang Prajapati ](https://profiles.wordpress.org/umangapps48/)

## Supporto

Problemi risolti negli ultimi due mesi:

     0 su 2

 [Chiedi nel forum di supporto](https://wordpress.org/support/plugin/ptp-private-media/)

## Dona

Vuoi supportare lo sviluppo di questo plugin?

 [ Fai una donazione per questo plugin ](https://phptutorialpoints.in/)