attachment_fields_to_save
Filters the attachment fields to be saved.
Usage
add_filter( 'attachment_fields_to_save', 'wp_kama_attachment_fields_to_save_filter', 10, 2 );
/**
* Function for `attachment_fields_to_save` filter-hook.
*
* @param array $post An array of post data.
* @param array $attachment An array of attachment metadata.
*
* @return array
*/
function wp_kama_attachment_fields_to_save_filter( $post, $attachment ){
// filter...
return $post;
}
- $post(array)
- An array of post data.
- $attachment(array)
- An array of attachment metadata.
Changelog
| Since 2.5.0 | Introduced. |
Where the hook is called
attachment_fields_to_save
attachment_fields_to_save
attachment_fields_to_save
wp-admin/includes/media.php 792
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
wp-admin/includes/post.php 435
$translated = apply_filters( 'attachment_fields_to_save', $translated, $attachment_data );
wp-admin/includes/ajax-actions.php 3227
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );