W3cubDocs

/WordPress

apply_filters( ‘attachment_link’, string $link, int $post_id )

Filters the permalink for an attachment.

Parameters

$linkstring
The attachment’s permalink.
$post_idint
Attachment ID.

Source

return apply_filters( 'attachment_link', $link, $post->ID );

Changelog

Version Description
5.6.0 Providing an empty string will now disable the view attachment page link on the media modal.
2.0.0 Introduced.

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