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
2580      if ( ! current_user_can( 'edit_post', $id ) )
2581           wp_send_json_error();
2582
2583      $post = get_post( $id, ARRAY_A );
2584
2585      if ( 'attachment' != $post['post_type'] )
2586           wp_send_json_error();
2587
2588      /** This filter is documented in wp-admin/includes/media.php */
2589      $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
2590
2591      if ( isset( $post['errors'] ) ) {
2592           $errors = $post['errors']; // @todo return me and display me!
2593           unset( $post['errors'] );
2594      }
2595
2596      wp_update_post( $post );
2597
2598      foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {