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 |
|---|---|
| 774 | * Filters the attachment fields to be saved. |
| 775 | * |
| 776 | * @since 2.5.0 |
| 777 | * |
| 778 | * @see wp_get_attachment_metadata() |
| 779 | * |
| 780 | * @param array $post An array of post data. |
| 781 | * @param array $attachment An array of attachment metadata. |
| 782 | */ |
| 783 | $post = apply_filters( 'attachment_fields_to_save', $post, $attachment ); |
| 784 | |
| 785 | if ( isset( $attachment['image_alt'] ) ) { |
| 786 | $image_alt = wp_unslash( $attachment['image_alt'] ); |
| 787 | |
| 788 | if ( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) !== $image_alt ) { |
| 789 | $image_alt = wp_strip_all_tags( $image_alt, true ); |
| 790 | |
| 791 | // update_post_meta() expects slashed. |
| 792 | update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); |