wp_get_attachment_image_attributes WordPress Filter Hook

The wp_get_attachment_image_attributes hook is used to filter the image attributes used by WordPress when retrieving an image from an attachment. This can be useful for changing the default image size, or for providing alternative text for the image.

apply_filters( 'wp_get_attachment_image_attributes', string[] $attr, WP_Post $attachment, string|int[] $size ) #

Filters the list of attachment image attributes.


Parameters

$attr

(string[])Array of attribute values for the image markup, keyed by attribute name. See wp_get_attachment_image().

$attachment

(WP_Post)Image attachment post.

$size

(string|int[])Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More