media_post_single_attachment_fields_to_edit()
云策文档标注
概述
media_post_single_attachment_fields_to_edit() 是一个 WordPress 过滤器函数,用于在编辑非图像附件时修改表单字段数组。它移除 'image_url' 字段,适用于自定义附件类型处理。
关键要点
- 函数作用:过滤附件编辑表单字段,移除非图像附件的 'image_url' 字段。
- 参数:接受 $form_fields(表单字段数组)和 $post(WP_Post 附件对象)两个必需参数。
- 返回值:返回过滤后的表单字段数组。
- 引入版本:WordPress 2.8.0。
代码示例
function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
unset( $form_fields['image_url'] );
return $form_fields;
}
原文内容
Retrieves the post non-image attachment fields to edit form fields.
Parameters
Source
function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
unset( $form_fields['image_url'] );
return $form_fields;
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |