wordpress / latest / hooks / wp_get_attachment_link.html

apply_filters( 'wp_get_attachment_link', string $link_html, int|WP_Post $post, string|int[] $size, bool $permalink, bool $icon, string|false $text, array|string $attr )

Filters a retrieved attachment page link.

Parameters

$link_html string
The page link HTML output.
$post int|WP_Post
Post ID or object. Can be 0 for the current global 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).
$permalink bool
Whether to add permalink to image. Default false.
$icon bool
Whether to include an icon.
$text string|false
If string, will be link text.
$attr array|string
Array or string of attributes.

Source

File: wp-includes/post-template.php. View all references

return apply_filters( 'wp_get_attachment_link', $link_html, $post, $size, $permalink, $icon, $text, $attr );

Used By

Used By Description

Changelog

Version Description
5.1.0 Added the $attr parameter.
2.7.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_get_attachment_link