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
376           if ( isset($attachment['post_title']) )
377                $post['post_title'] = $attachment['post_title'];
378           if ( isset($attachment['post_excerpt']) )
379                $post['post_excerpt'] = $attachment['post_excerpt'];
380           if ( isset($attachment['menu_order']) )
381                $post['menu_order'] = $attachment['menu_order'];
382           if ( isset($attachment['post_parent']) )
383                $post['post_parent'] = $attachment['post_parent'];
384
385           $post = apply_filters('attachment_fields_to_save', $post, $attachment);
386
387           if ( isset($post['errors']) ) {
388                $errors[$attachment_id] = $post['errors'];
389                unset($post['errors']);
390           }
391
392           if ( $post != $_post )
393                wp_update_post($post);
394