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
1920
1921      if ( ! current_user_can( 'edit_post', $id ) )
1922           wp_send_json_error();
1923
1924      $post = get_post( $id, ARRAY_A );
1925
1926      if ( 'attachment' != $post['post_type'] )
1927           wp_send_json_error();
1928
1929      $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
1930
1931      if ( isset( $post['errors'] ) ) {
1932           $errors = $post['errors']; // @todo return me and display me!
1933           unset( $post['errors'] );
1934      }
1935
1936      wp_update_post( $post );
1937
1938      foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {