attachment_fields_to_save
This is a WordPress - attachment_fields_to_save hook. The plugin just uses it.
This filter is documented in wp-admin/includes/media.php
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.
Where the hook is called
attachment_fields_to_save
acf/pro/fields/class-acf-field-gallery.php 197
$post = apply_filters( 'attachment_fields_to_save', $post, $changes );
Where the hook is used in Advanced Custom Fields PRO
acf/includes/forms/form-attachment.php 39
add_filter( 'attachment_fields_to_save', array( $this, 'save_attachment' ), 10, 2 );