wp_update_attachment_metadata
函数
wp_update_attachment_metadata ( $attachment_id, $data )
- 参数
-
-
(int)
$attachment_id
Attachment post ID.- Required: 是
-
(array)
$data
Attachment meta data.- Required: 是
-
(int)
- 返回值
-
- (int|false) False if $post is invalid.
- 定义位置
-
-
wp-includes/post.php
, line 6597
-
wp-includes/post.php
- 引入
- 2.1.0
- 弃用
- –
Updates metadata for an attachment.
function wp_update_attachment_metadata( $attachment_id, $data ) { $attachment_id = (int) $attachment_id; $post = get_post( $attachment_id ); if ( ! $post ) { return false; } /** * Filters the updated attachment meta data. * * @since 2.1.0 * * @param array $data Array of updated attachment meta data. * @param int $attachment_id Attachment post ID. */ $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); if ( $data ) { return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); } else { return delete_post_meta( $post->ID, '_wp_attachment_metadata' ); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。