WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
2520 | if ( ! current_user_can( 'edit_post', $id ) ) |
2521 | wp_send_json_error(); |
2522 |
|
2523 | $post = get_post( $id, ARRAY_A ); |
2524 |
|
2525 | if ( 'attachment' != $post['post_type'] ) |
2526 | wp_send_json_error(); |
2527 |
|
2528 | /** This filter is documented in wp-admin/includes/media.php */ |
2529 | $post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data ); |
2530 |
|
2531 | if ( isset( $post['errors'] ) ) { |
2532 | $errors = $post['errors']; // @todo return me and display me! |
2533 | unset( $post['errors'] ); |
2534 | } |
2535 |
|
2536 | wp_update_post( $post ); |
2537 |
|
2538 | foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { |