Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: attachment_fields_to_save

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
316                     $image_alt = wp_strip_all_tags( $image_alt, true );
317                     // update_meta expects slashed.
318                     update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
319                }
320           }
321
322           $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
323
324           /** This filter is documented in wp-admin/includes/media.php */
325           $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
326      }
327
328      // Convert taxonomy input to term IDs, to avoid ambiguity.
329      if ( isset( $post_data['tax_input'] ) ) {
330           foreach ( (array) $post_data['tax_input'] as $taxonomy => $terms ) {
331                // Hierarchical taxonomy data is already sent as term IDs, so no conversion is necessary.
332                if ( is_taxonomy_hierarchical( $taxonomy ) ) {
333                     continue;
334                }