Filter hook 'wp_get_attachment_metadata'

in WP Core File wp-includes/post.php at line 6835

View Source

wp_get_attachment_metadata

Filter Hook
Description
Filters the attachment meta data.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 6835

Hook Parameters

Type Name Description
array $data Array of meta data for the given attachment.
int $attachment_id Attachment post ID.

Usage Examples

Basic Usage
<?php
// Hook into wp_get_attachment_metadata
add_filter('wp_get_attachment_metadata', 'my_custom_filter', 10, 2);

function my_custom_filter($data, $attachment_id) {
    // Your custom filtering logic here
    return $data;
}

Source Code Context

wp-includes/post.php:6835 - How this hook is used in WordPress core
<?php
6830  	 * @since 2.1.0
6831  	 *
6832  	 * @param array $data          Array of meta data for the given attachment.
6833  	 * @param int   $attachment_id Attachment post ID.
6834  	 */
6835  	return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id );
6836  }
6837  
6838  /**
6839   * Updates metadata for an attachment.
6840   *

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.