wp_update_attachment_metadata
Filters the updated attachment meta data.
Description
Parameters (2)
- 0. $data (array)
- Array of updated attachment meta data.
- 1. $post_id (int)
- Attachment ID.
Usage
- To run the hook, copy the example below.
- $data = apply_filters( 'wp_update_attachment_metadata', $data, $post_id );
- if ( !empty( $data ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the wp_update_attachment_metadata callback
- function filter_wp_update_attachment_metadata( $data, $post_id ) {
- // make filter magic happen here...
- return $data;
- };
- // add the filter
- add_filter( 'wp_update_attachment_metadata', 'filter_wp_update_attachment_metadata', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'wp_update_attachment_metadata', 'filter_wp_update_attachment_metadata', 10, 2 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/post.php
- if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )