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 |
|---|---|
| 559 | $size = join('x', $size); |
| 560 | $attachment =& get_post($attachment_id); |
| 561 | $default_attr = array( |
| 562 | 'src' => $src, |
| 563 | 'class' => "attachment-$size", |
| 564 | 'alt' => trim(strip_tags( $attachment->post_excerpt )), |
| 565 | 'title' => trim(strip_tags( $attachment->post_title )), |
| 566 | ); |
| 567 | $attr = wp_parse_args($attr, $default_attr); |
| 568 | $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment ); |
| 569 | $attr = array_map( 'esc_attr', $attr ); |
| 570 | $html = rtrim("<img $hwstring"); |
| 571 | foreach ( $attr as $name => $value ) { |
| 572 | $html .= " $name=" . '"' . $value . '"'; |
| 573 | } |
| 574 | $html .= ' />'; |
| 575 | } |
| 576 | |
| 577 | return $html; |