WP Media Folder 开发者文档
本文档将帮助经验丰富的开发人员使用我们的插件插入任何其他服务。 以下是该插件的所有操作和过滤器,如果您需要更多,请随时通过 专用论坛询问。 感谢您使用我们的插件!
辅助文件
WP Media Folder 附带一个辅助文件,其中包含了将其集成到您自己的主题和插件中可能需要的主要功能。.
- 将文件移动到文件夹中
- 创建文件夹
- 移动文件夹
- 获取文件夹中的附件
- ...
include('wp-content/plugins/wp-media-folder/helper.php');
\Joomunited\WPMediaFolder\Helper::createFolder('My new folder'); 钩子
import_term_meta
导入术语元后触发。
参数:
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-main.php 第 890 行class/class-main.php 第 921 行class/class-main.php 第 2805行 class/class-main.php 第 3363 行class/class-main.php 第 4590行 class/class-main.php 第 5391 class-helper.php 第 140 行class/class-helper.php 第 196 行class/class-wp-folder-option.php 第 457 行class/class-wp-folder-option.php 第 3638 行
wpmf_before_delete_folder
删除文件夹之前
参数:
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
在文件中:
class/class-main.php 第 4113 行class/class-main.php 第 4490 行
wpmf_create_folder
从媒体库创建文件夹。此钩子也用于从 FTP 同步和导入文件、创建基于用户和角色的文件夹以及从 Nextgen Gallery 导入文件。
参数:
integer Created folder IDstring Created folder nameinteger Parent folder IDarray Extra informations
Return :
void
在文件中:
class/class-main.php 第 2782 行class/class-main.php 第 3620 行class/class-main.php 第 3634 行class/class-main.php 第 3938 行class/class-wp-folder-option.php 第 3515 行
wpmf_删除文件夹
删除文件夹
参数:
WP_Term Folder, this term is not available anymore as it as been deleted
Return :
void
在文件中:
class/class-main.php 第 4121 行class/class-main.php 第 4499 行
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-main.php 第 4687 行class/class-wp-folder-option.php 第 3030 行
wpmf_update_folder_name
更新文件夹名称
参数:
integer Folder IDstring Updated name
Return :
void
在文件中:
class/class-folder-post-type.php 第 500 行class/class-main.php 第 4052 行
wpmf_update_folder_name
更新文件夹名称
参数:
integer Folder IDstring Updated name
Return :
void
在文件中:
class/class-folder-post-type.php 第 500 行class/class-main.php 第 4052 行
备用中间图像尺寸
过滤为非图像 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
筛选导入的术语meta的meta键。
参数:
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 第 2237 行
wpmf_limit_folders
筛选器用于设置加载文件夹数量的限制
参数:
integer Limit folder number
Return :
integer
在文件中:
class/class-folder-post-type.php 第 1769 行class/class-main.php 第 1688 行
wpmf_limit_folders
筛选器用于设置加载文件夹数量的限制
参数:
integer Limit folder number
Return :
integer
在文件中:
class/class-folder-post-type.php 第 1769 行class/class-main.php 第 1688 行
wpmf_set_file_title
在将文件保存到数据库之前修改文件名
参数:
string File title
Return :
string
在文件中:
class/class-main.php 第 5512 行
wpmf_taxonomy_public
筛选器更改公共参数 wpmf-category 分类
参数:
boolean Toxonomy public status
Return :
boolean
在文件中:
wp-media-folder.php 第 1569 行
wpmf_user_can
筛选器检查用户执行操作的能力
参数:
boolean The current user has the given capabilitystring Action name
Return :
boolean
在文件中:
class/install-wizard/install-wizard.php 第 54 行class/class-duplicate-file.php 第 53 行class/class-main.php 第 1111 行class/class-main.php 第 1483 行class/class-main.php 第 1522行 class/class-main.php 第 1703行 class/class-main.php 第 2659行 class/class-main.php 第 2693行 class/class-main.php 第 3495 行class/class-main.php 第 3887 行class/class-main.php 第 3999行 class/class-main.php 第 4372 行class/class-main.php 第 4424 行class/class-main.php 第 4537行 class/class-main.php 第 4633 行class/class-main.php 第 4723 行class/class-main.php 第 5005 行class/class-main.php 第 5138 行class/class-main.php 第 5329 行class/class-main.php 第 5797 行class/class-main.php 第 5844行 class/class-image-watermark.php 第 252 行class/class-replace-file.php 第 53 行class/class-replace-file.php 第 509 行class/class-folder-access.php 第 41 行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-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 第 2230 行class/class-wp-folder-option.php 第 3483 行class/class-wp-folder-option.php 第 4186 行class/class-wp-folder-option.php 第 4286 行class/class-wp-folder-option.php 第 4354 行class/class-wp-folder-option.php 第 4467 行class/class-wp-folder-option.php 第 4518 行class/class-wp-folder-option.php 第 4566 行wp-media-folder.php 第 36 行
Composer
使用 WP CLI 以编程方式设置更新密钥
使用您用于安装 Composer 的相同密钥并执行此 Composer 命令来设置更新令牌 wp option update ju_user_token "YOUR_TOKEN"
以下是使用 Composer 依赖项安装我们插件的方法。您需要在 composer.json 文件中声明 Joomunited 仓库,请务必将 URL 中的 YOUR_TOKEN 替换为您自己的令牌。您可以在