attachment_fields_to_save

The WordPress Core attachment fields to save hook.

Description

apply_filters( 'attachment_fields_to_save', (unknown) $post_data, (unknown) $attachment_data ); 

Parameters (2)

0. $post_data (unknown)
The post data.
1. $attachment_data (unknown)
The attachment data.

Usage

To run the hook, copy the example below.
  1. $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data ); 
  2.  
  3. if ( !empty( $post_data ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the attachment_fields_to_save callback 
  2. function filter_attachment_fields_to_save( $post_data, $attachment_data ) { 
  3. // make filter magic happen here... 
  4. return $post_data
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'attachment_fields_to_save', 'filter_attachment_fields_to_save', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'attachment_fields_to_save', 'filter_attachment_fields_to_save', 10, 2 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-admin/includes/post.php  
  1. $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data ); 
/wp-admin/includes/media.php  
  1. $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); 
/wp-admin/includes/ajax-actions.php  
  1. $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );