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
400                $post['post_excerpt'] = $attachment['post_excerpt'];
401           if ( isset($attachment['menu_order']) )
402                $post['menu_order'] = $attachment['menu_order'];
403
404           if ( isset($send_id) && $attachment_id == $send_id ) {
405                if ( isset($attachment['post_parent']) )
406                     $post['post_parent'] = $attachment['post_parent'];
407           }
408
409           $post = apply_filters('attachment_fields_to_save', $post, $attachment);
410
411           if ( isset($attachment['image_alt']) && !empty($attachment['image_alt']) ) {
412                $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
413                if ( $image_alt != stripslashes($attachment['image_alt']) ) {
414                     $image_alt = wp_strip_all_tags( stripslashes($attachment['image_alt']), true );
415                     // update_meta expects slashed
416                     update_post_meta( $attachment_id, '_wp_attachment_image_alt', addslashes($image_alt) );
417                }
418           }