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
3206      }
3207
3208      $post = get_post( $id, ARRAY_A );
3209
3210      if ( 'attachment' !== $post['post_type'] ) {
3211           wp_send_json_error();
3212      }
3213
3214      /** This filter is documented in wp-admin/includes/media.php */
3215      $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
3216
3217      if ( isset( $post['errors'] ) ) {
3218           $errors = $post['errors']; // @todo return me and display me!
3219           unset( $post['errors'] );
3220      }
3221
3222      wp_update_post( $post );
3223
3224      foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {