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
305                     $image_alt = wp_strip_all_tags( $image_alt, true );
306                     // update_meta expects slashed.
307                     update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
308                }
309           }
310
311           $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
312
313           /** This filter is documented in wp-admin/includes/media.php */
314           $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
315      }
316
317      add_meta( $post_ID );
318
319      update_post_meta( $post_ID, '_edit_last', get_current_user_id() );
320
321      $success = wp_update_post( $post_data );
322      // If the save failed, see if we can sanity check the main fields and try again
323      if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) {