wp_get_attachment_link_attributes
wp_get_attachment_link_attributes
Appears in: wordpress-6.2
Hook Type: filter
Displaying hooks found in version: wordpress-6.2apply_filters('wp_get_attachment_link_attributes') is found 1 times:
- /wp-includes/post-template.php line 167816741675167616771678167916801681168216831684
* @param
array
$attributes
An
array
of attributes
for
the link markup,
* keyed on the attribute name.
* @param int
$id
Post ID.
*/
$attributes
= apply_filters(
'wp_get_attachment_link_attributes'
,
array
(
'href'
=>
$url
),
$_post
->ID );
$link_attributes
=
''
;
foreach
(
$attributes
as
$name
=>
$value
) {
$value
=
'href'
===
$name
? esc_url(
$value
) : esc_attr(
$value
);
$link_attributes
.=
' '
. esc_attr(
$name
) .
"='"
.
$value
.
"'"
;
}