async_upload_{$type}
云策文档标注
概述
async_upload_{$type} 是一个 WordPress 过滤器钩子,用于过滤上传附件后返回的附件 ID。钩子名称中的动态部分 $type 表示附件类型,如音频、文件、图像或视频。
关键要点
- 钩子名称:async_upload_{$type},其中 $type 是动态参数,对应附件类型。
- 参数:$id,表示上传附件的 ID,类型为整数。
- 用途:在异步上传过程中,允许开发者修改返回的附件 ID。
- 示例钩子:async_upload_audio、async_upload_file、async_upload_image、async_upload_video。
- 引入版本:WordPress 2.5.0。
代码示例
echo apply_filters( "async_upload_{$type}", $id );
原文内容
Filters the returned ID of an uploaded attachment.
Description
The dynamic portion of the hook name, $type, refers to the attachment type.
Possible hook names include:
async_upload_audioasync_upload_fileasync_upload_imageasync_upload_video
Parameters
$idint-
Uploaded attachment ID.
Source
echo apply_filters( "async_upload_{$type}", $id );
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |