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 |
|---|---|
| 256 | $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); |
| 257 | if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) { |
| 258 | $image_alt = wp_strip_all_tags( $image_alt, true ); |
| 259 | // update_meta expects slashed |
| 260 | update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | $attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array(); |
| 265 | $post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data ); |
| 266 | } |
| 267 | |
| 268 | add_meta( $post_ID ); |
| 269 | |
| 270 | update_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); |
| 271 | |
| 272 | wp_update_post( $post_data ); |
| 273 | |
| 274 | // Now that we have an ID we can fix any attachment anchor hrefs |