wp_get_attachment_metadata() WP 1.0
Retrieve attachment meta field for attachment ID.
Works based on: get_post_meta()
Basis of: image_get_intermediate_size()
1 time = 0.000745s = slow | 50000 times = 1.22s = fast | PHP 7.0.8, WP 4.6
Hooks from the function
Return
Array/false. Attachment metadata. False on failure.
-
width(int)
The width of the attachment. -
height(int)
The height of the attachment. -
file(string)
The file path relative to wp-content/uploads. -
sizes(array)
Keys are size slugs, each value is an array containing 'file', 'width', 'height', and 'mime-type'. - image_meta(array)
Image metadata.
Usage
wp_get_attachment_metadata( $attachment_id, $unfiltered );
- $attachment_id(int)
- Attachment post ID.
Default: global $post - $unfiltered(true/false)
- If true, filters are not run.
Default: false
Changelog
Since 2.1.0 | Introduced. |