wp_insert_attachment_data filter-hook . WP 3.9.0
Filters attachment post data before it is updated in or added to the database.
Usage
add_filter( 'wp_insert_attachment_data', 'filter_function_name_7856', 10, 3 ); function filter_function_name_7856( $data, $postarr, $unsanitized_postarr ){ // filter... return $data; }
- $data(array)
- An array of slashed, sanitized, and processed attachment post data.
- $postarr(array)
- An array of slashed and sanitized attachment post data, but not processed.
- $unsanitized_postarr(array)
- An array of slashed yet unsanitized and unprocessed attachment post data as originally passed to wp_insert_post().
Changelog
Since 3.9.0 | Introduced. |
Since 5.4.1 | $unsanitized_postarr argument added. |
Where the hook is called
wp_insert_attachment_data
wp-includes/post.php 4007
$data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr );