Title: Private Media
Author: Alexandre Froger
Published: <strong>2018 年 9 月 1 日</strong>
Last modified: 2019 年 1 月 22 日

---

搜索插件

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

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/private-media/assets/icon.svg?rev=1934410)

# Private Media

 作者：[Alexandre Froger](https://profiles.wordpress.org/frogerme/)

[下载](https://downloads.wordpress.org/plugin/private-media.zip)

 * [详情](https://cn.wordpress.org/plugins/private-media/#description)
 * [评价](https://cn.wordpress.org/plugins/private-media/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/private-media/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/private-media/#developers)

 [支持](https://wordpress.org/support/plugin/private-media/)

## 描述

Ever wanted to make your media truely private? Make sure images, videos and other
files are only accessible to chosen roles, or cannot be hotlinked, with permissions
specifically set per item.

This plugin adds the following major features to WordPress:

 * **Media Privacy:** Lock access to items in the Media Library by preventing hotlinks
   only or by limiting access to files to selected user roles.
 * **User-friendly forbidden handler:** Images set to private do not break on the
   frontend. Instead, they are replaced by a simple access denied SVG picture – 
   the forbidden handler can be replaced using the filter hooks `pvtmed_forbidden_response_content`(`
   apply_filters( 'pvtmed_forbidden_response_content', $forbidden_response_content,
   $file );`) and `pvtmed_forbidden_mimetype` (`apply_filters( 'pvtmed_forbidden_mimetype','
   image/svg+xml' );`).
 * **Customizable for more granularity:** Restricted media will be checked for autorization–
   plugin developers can hook into the `pvtmed_is_authorized` filter (`apply_filters('
   pvtmed_is_authorized', $authorized, $attachment_id );`) to apply more complex
   conditions for authorization.
 * **Optimized private media delivery:** Files with access restriction are served
   using streams without loading the file entirely in memory before delivery, and
   WordPress files are loaded as lightly as possible for an optimised server memory
   usage.
 * **Fallbacks:** Restricted files are kept in an alternate `wp-content/pvtmed-uploads`
   folder (or equivalent if `WP_CONTENT_DIR` is not the default) ; fallbacks are
   in place to make sure:
    - moving a media to private does not break previously embedded media (javascript
      dynamic fallback with notice on post edit screen – Classic Editor only).
    - deactivating the plugin does not break previously embedded media (database
      update).
    - deleting the plugin does not break previously embedded media (database update).

A [Must Use Plugin](https://codex.wordpress.org/Must_Use_Plugins) `pvtmed-endpoint-
optimizer.php` is installed automatically to make sure WordPress is loaded as lightly
as possible when requesting restricted media items. Developers can safely edit it
to enable their plugin to execute during such request if necessary.

The media privacy policy is set per media item – therefore, this plugin is not a
replacement for general image hotlink prevention plugins, but is ideal for anyone
looking for preventing direct links to files depending on specific conditions.

## 安装

This section describes how to install the plugin and get it working.

 1. Upload the plugin files to the `/wp-content/plugins/private-media` directory, or
    install the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Edit Media Privacy Settings on media items in the Media Library

## 评价

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

### 󠀁[zeer goed](https://wordpress.org/support/topic/zeer-goed-2/)󠁿

 [mar tim](https://profiles.wordpress.org/mar-tim/) 2018 年 11 月 20 日 1 回复

goed om je media te beschermen als je ook gebruik maakt van een memberschip plugin,
doet precies wat het doen moet

 [ 阅读所有1条评价 ](https://wordpress.org/support/plugin/private-media/reviews/)

## 贡献者及开发者

「Private Media」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Alexandre Froger ](https://profiles.wordpress.org/frogerme/)

[帮助将「Private Media」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/private-media)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/private-media/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/private-media/)，或通过[RSS](https://plugins.trac.wordpress.org/log/private-media/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/private-media/)。

## 更新日志

#### 1.2

 * Add `pvtmed_private_upload_url` and `pvtmed_htaccess_rules` filters (see this
   support request for details)

#### 1.1

 * Bump version – supported by WordPress 5.0 (post edit screen fallbacks only in
   Classic Editor)

#### 1.0

 * First version

## 额外信息

 *  版本 **1.2**
 *  最后更新：**7 年前**
 *  活跃安装数量 **40+**
 *  WordPress 版本 ** 4.9.8 或更高版本 **
 *  已测试的最高版本为 **4.9.29**
 *  PHP 版本 ** 7.0 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/private-media/)
 * 标签
 * [media](https://cn.wordpress.org/plugins/tags/media/)[private](https://cn.wordpress.org/plugins/tags/private/)
   [uploads](https://cn.wordpress.org/plugins/tags/uploads/)
 *  [高级视图](https://cn.wordpress.org/plugins/private-media/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/private-media/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/private-media/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/private-media/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/private-media/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/private-media/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/private-media/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/private-media/reviews/)

## 贡献者

 *   [ Alexandre Froger ](https://profiles.wordpress.org/frogerme/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/private-media/)