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 )

In this article

Filters a retrieved attachment page link.


The page link HTML output.
Post ID or object. Can be 0 for the current global post.
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
Whether to add permalink to image. Default false.
Whether to include an icon.
If string, will be link text.
Array or string of attributes.


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


5.1.0Added the $attr parameter.

User Contributed Notes

You must log in before being able to contribute a note or feedback.