wp_get_attachment_link_attributes
Filters the list of attachment link attributes.
Использование
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(массив)
- An array of attributes for the link markup, keyed on the attribute name.
- $id(int)
- Post ID.
Список изменений
| С версии 6.2.0 | Введена. |
Где вызывается хук
wp_get_attachment_link_attributes
wp-includes/post-template.php 1687
$attributes = apply_filters( 'wp_get_attachment_link_attributes', array( 'href' => $url ), $_post->ID );