wp_create_file_in_uploads
云策文档标注
概述
wp_create_file_in_uploads 是一个 WordPress 过滤器,用于在设置自定义页眉或背景图像后,过滤附件文件路径。主要用于文件复制场景。
关键要点
- 过滤器名称:wp_create_file_in_uploads
- 用途:在自定义页眉或背景图像设置后,修改附件文件路径,支持文件复制操作
- 参数:$file(文件路径字符串)、$attachment_id(附件 ID 整数)
- 调用示例:$file = apply_filters( 'wp_create_file_in_uploads', $file, $attachment_id );
- 相关函数:包括 wp_ajax_crop_image()、Custom_Image_Header 和 Custom_Background 类中的多个方法
- 引入版本:WordPress 2.1.0
原文内容
Filters the attachment file path after the custom header or background image is set.
Description
Used for file replication.
Parameters
$filestring-
Path to the file.
$attachment_idint-
Attachment ID.
Source
$file = apply_filters( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |