wp_get_attachment_metadata( int $attachment_id, bool $unfiltered = false )
Retrieves attachment metadata for attachment ID.
Parameters
- $attachment_id
-
(Required) Attachment post ID. Defaults to global $post.
- $unfiltered
-
(Optional) If true, filters are not run.
Default value: false
Return
(array|false) Attachment metadata. False on failure.<br>
- 'width'
(int) The width of the attachment.<br> - 'height'
(int) The height of the attachment.<br> - 'file'
(string) The file path relative towp-content/uploads
.<br> - 'sizes'
(array) Keys are size slugs, each value is an array containing 'file', 'width', 'height', and 'mime-type'.<br> - 'image_meta'
(array) Image metadata.<br> - 'filesize'
(int) File size of the attachment.<br>
Source
File: wp-includes/post.php
Changelog
Version | Description |
---|---|
6.0.0 | The $filesize value was added to the returned array. |
2.1.0 | Introduced. |