WP Media Folder 开发者文档
本文档将帮助经验丰富的开发者将其他服务与我们的插件集成。以下是此插件的所有操作和过滤器,如果您需要更多信息,请随时在 专属论坛上提问。感谢您使用我们的插件!
辅助文件
WP Media Folder 附带一个辅助文件,其中包含了将其集成到您自己的主题和插件中可能需要的主要功能。.
- 将文件移动到文件夹中
- 创建文件夹
- 移动文件夹
- 获取文件夹中的附件
- ...
include('wp-content/plugins/wp-media-folder/helper.php');
\Joomunited\WPMediaFolder\Helper::createFolder('My new folder'); 钩子
导入术语元数据
在术语元数据导入后触发。.
参数 :
int $term_id ID of the newly created term.string $key Meta key.mixed $value Meta value.
Return :
void
文件内容:
class/import/class-wp-import.php 第 451 行
wpmf_after_replace
替换文件后执行操作
参数 :
integer Attachment ID
Return :
void
文件内容:
class/class-replace-file.php 第 462 行
wpmf_attachment_set_folder
在媒体管理器中将附件移动到文件夹后,设置附件文件夹。此钩子也用于将附件导入类别、上传附件后以及为附件分配多个文件夹时。
参数 :
integer Attachment IDinteger|array Target folder or array of target foldersarray Extra informations
Return :
void
文件内容:
class/class-wp-folder-option.php 第 457 行class/class-wp-folder-option.php 第 3613 行class/class-helper.php 第 140 行class/class-helper.php 第 196 行class/class-main.php 第 912行 class/class-main.php 第 943 行class/class-main.php 第 2831行 class/class-main.php 第 3389行 class/class-main.php 第 4616 行class/class-main.php 第 5417 行
wpmf_before_delete_folder
删除文件夹之前
参数 :
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
文件内容:
class/class-main.php 第 4139 行class/class-main.php 第 4516 行
wpmf_create_folder
从媒体库创建文件夹。此钩子也用于从 FTP 同步和导入文件、创建基于用户和角色的文件夹以及从 Nextgen Gallery 导入文件。
参数 :
integer Created folder IDstring Created folder nameinteger Parent folder IDarray Extra informations
Return :
void
文件内容:
class/class-wp-folder-option.php 第 3490 行class/class-main.php 第 2808 行class/class-main.php 第 3646 行class/class-main.php 第 3660 行class/class-main.php 第 3964 行
wpmf_删除文件夹
删除文件夹
参数 :
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
文件内容:
class/class-main.php 第 4147 行class/class-main.php 第 4525 行
wpmf_duplicate_attachment
复制附件
参数 :
integer Attachment IDinteger Target folder
Return :
void
文件内容:
class/class-duplicate-file.php 第 118 行
wpmf_move_folder
从媒体库移动文件夹。更改角色文件夹选项时也会使用此钩子。
参数 :
integer Folder moved IDstring Destination folder IDarray Extra informations
Return :
void
文件内容:
class/class-wp-folder-option.php 第 3005 行class/class-main.php 第 4713 行
wpmf_update_folder_name
更新文件夹名称
参数 :
integer Folder IDstring Updated name
Return :
void
文件内容:
class/class-folder-post-type.php 第 500 行class/class-main.php 第 4078 行
wpmf_update_folder_name
更新文件夹名称
参数 :
integer Folder IDstring Updated name
Return :
void
文件内容:
class/class-folder-post-type.php 第 500 行class/class-main.php 第 4078 行
备用中间图像尺寸
过滤为非图像 MIME 类型生成的图像尺寸。.
参数 :
array $fallback_sizes An array of image size names.array $metadata Current attachment metadata.
Return :
void
文件内容:
class/class-helper.php 第 312 行
import_term_meta_key
筛选导入的术语元数据的元键。.
参数 :
string $meta_key Meta key.int $term_id ID of the newly created term.array $term Term data from the WXR import.
Return :
void
文件内容:
class/import/class-wp-import.php 第 432 行
wp_import_existing_post
筛选与当前导入文章对应的现有文章 ID。返回 0 可强制导入该文章。将 ID 设置为其他值可覆盖默认的现有文章与导入文章的映射关系。.
参数 :
int $post_exists Post ID, or 0 if post did not exist.array $post The post array to be inserted.
Return :
void
文件内容:
class/import/class-wp-import.php 第 505 行
wp_import_term_meta
筛选导入术语所附加的元数据。.
参数 :
array $termmeta Array of term meta.int $term_id ID of the newly created term.array $term Term data from the WXR import.
Return :
void
文件内容:
class/import/class-wp-import.php 第 416 行
wpmf_gallery_enable_download
筛选器,启用/禁用从图库下载图片
参数 :
boolean Enable/disable download image
Return :
boolean
文件内容:
class/class-display-gallery.php 第 473 行
wpmf_gallery_query_args
筛选图库查询参数以获取图像。.
参数 :
array Gallery query arguments
Return :
array
文件内容:
class/class-display-gallery.php 第 411 行
wpmf_get_categories_args
使用自定义参数筛选以获取所有类别
参数 :
array Agument
Return :
array
文件内容:
class/class-main.php 第 2263 行
wpmf_limit_folders
筛选器用于设置加载文件夹数量的限制
参数 :
integer Limit folder number
Return :
integer
文件内容:
class/class-folder-post-type.php 第 1769 行class/class-main.php 第 1710 行
wpmf_limit_folders
筛选器用于设置加载文件夹数量的限制
参数 :
integer Limit folder number
Return :
integer
文件内容:
class/class-folder-post-type.php 第 1769 行class/class-main.php 第 1710 行
wpmf_set_file_title
在将文件保存到数据库之前修改文件名
参数 :
string File title
Return :
string
文件内容:
class/class-main.php 第 5538 行
wpmf_taxonomy_public
筛选器更改公共参数 wpmf-category 分类
参数 :
boolean Toxonomy public status
Return :
boolean
文件内容:
wp-media-folder.php 第 1570 行
wpmf_user_can
筛选器检查用户执行操作的能力
参数 :
boolean The current user has the given capabilitystring Action name
Return :
boolean
文件内容:
wp-media-folder.php 第 36 行class/class-wp-folder-option.php 第 928行 class/class-wp-folder-option.php 第 1135行 class/class-wp-folder-option.php 第 1186行 class/class-wp-folder-option.php 第 1478行 class/class-wp-folder-option.php 第 1565行 class/class-wp-folder-option.php 第 2204行 class/class-wp-folder-option.php 第 3458行 class/class-wp-folder-option.php 第 4161行 class/class-wp-folder-option.php 第 4261行 class/class-wp-folder-option.php 第 4329 行class/class-wp-folder-option.php 第 4442 行class/class-wp-folder-option.php 第 4493 行class/class-wp-folder-option.php 第 4541 行class/class-folder-access.php 第 41 行class/class-duplicate-file.php 第 53 行class/install-wizard/install-wizard.php 第 54 行class/class-image-watermark.php 第 252 行class/class-main.php 第 1133 行class/class-main.php 第 1505行 class/class-main.php 第 1544 行class/class-main.php 第 1726 行class/class-main.php 第 2685行 class/class-main.php 第 2719 行class/class-main.php 第 3521 行class/class-main.php 第 3913 行class/class-main.php 第 4025 行class/class-main.php 第 4398 行class/class-main.php 第 4450 行class/class-main.php 第 4563 行class/class-main.php 4659 class/class-main.php 第 4749 行class/class-main.php 第 5031 行class/class-main.php 第 5164行 class/class-main.php 第 5355 行class/class-main.php 第 5823 行class/class-main.php 第 5870 行class/pages/settings/image_compression.php 第 44 行class/pages/settings/image_compression.php 第 98 行class/pages/settings/image_compression.php 第 252 行class/pages/settings/image_compression.php 第 288 行class/pages/settings/import_export.php 第 159 行class/pages/settings/import_export.php 第 332 行class/class-replace-file.php 第 53 行class/class-replace-file.php 第 509 行
Composer
使用 WP CLI 以编程方式设置更新密钥
使用与 Composer 安装时相同的密钥,并执行此 Composer 命令来设置更新令牌。 wp option update ju_user_token "YOUR_TOKEN"
以下是使用 Composer 依赖项安装我们插件的方法。您需要在 composer.json 文件中声明 Joomunited 仓库,请务必将 URL 中的 YOUR_TOKEN 替换为您自己的令牌。您可以在