wp_get_attachment_image_attributes

wp_get_attachment_image_attributes

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.7.2

apply_filters('wp_get_attachment_image_attributes') is found 1 times:

  • /wp-includes/media.php line 1165
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    * @param WP_Post      $attachment Image attachment post.
     * @param string|int[] $size       Requested image size. Can be any registered image size name, or
     *                                 an array of width and height values in pixels (in that order).
     */
    $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
     
    $attr = array_map( 'esc_attr', $attr );
    $html = rtrim( "<img $hwstring" );
     
    foreach ( $attr as $name => $value ) {
        $html .= " $name=" . '"' . $value . '"';

See this hook used in plugins: