attachment_fields_to_save
The WordPress Core attachment fields to save hook.
Description
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.
- $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
- if ( !empty( $post_data ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the attachment_fields_to_save callback
- function filter_attachment_fields_to_save( $post_data, $attachment_data ) {
- // make filter magic happen here...
- return $post_data;
- };
- // add the filter
- add_filter( 'attachment_fields_to_save', 'filter_attachment_fields_to_save', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- 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
- $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
- /wp-admin/includes/media.php
- $post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
- /wp-admin/includes/ajax-actions.php
- $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );