wp-includes/post.php:7101Retrieves attachment metadata for attachment ID.
$attachment_idintoptional0$unfilteredbooloptionalfalsearray|false$widthint
$heightint
$filestring
$sizesarray
$image_metaarray
$filesizeint
One hook fires while wp_get_attachment_metadata() runs, in this order:
Filters the attachment meta data.
function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { $attachment_id = (int) $attachment_id; if ( ! $attachment_id ) { $post = get_post(); if ( ! $post ) { return false; } $attachment_id = $post->ID; } $data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); if ( ! is_array( $data ) || ! $data ) { return false; } if ( $unfiltered ) { return $data; } /** * Filters the attachment meta data. * * @since 2.1.0 * * @param array $data Array of meta data for the given attachment. * @param int $attachment_id Attachment post ID. */ $data = apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); if ( ! is_array( $data ) ) { return false; } if ( array_key_exists( 'sizes', $data ) && ! is_array( $data['sizes'] ) ) { $data['sizes'] = array(); } return $data;}Introduced in 2.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.