wp_get_attachment_link_attributes
Filters the list of attachment link attributes.
Usage
add_filter( 'wp_get_attachment_link_attributes', 'wp_kama_get_attachment_link_attributes_filter', 10, 2 ); /** * Function for `wp_get_attachment_link_attributes` filter-hook. * * @param array $attributes An array of attributes for the link markup, keyed on the attribute name. * @param int $id Post ID. * * @return array */ function wp_kama_get_attachment_link_attributes_filter( $attributes, $id ){ // filter... return $attributes; }
- $attributes(array)
- An array of attributes for the link markup, keyed on the attribute name.
- $id(int)
- Post ID.
Changelog
Since 6.2.0 | Introduced. |
Where the hook is called
wp_get_attachment_link_attributes
wp-includes/post-template.php 1680
$attributes = apply_filters( 'wp_get_attachment_link_attributes', array( 'href' => $url ), $_post->ID );