wp_get_attachment_link хук-фильтрWP 2.7.0

Filters a retrieved attachment page link.

Использование

add_filter( 'wp_get_attachment_link', 'wp_kama_get_attachment_link_filter', 10, 7 );

/**
 * Function for `wp_get_attachment_link` filter-hook.
 * 
 * @param string       $link_html The page link HTML output.
 * @param int|WP_Post  $post      Post ID or object. Can be 0 for the current global post.
 * @param string|int[] $size      Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
 * @param bool         $permalink Whether to add permalink to image.
 * @param bool         $icon      Whether to include an icon.
 * @param string|false $text      If string, will be link text.
 * @param array|string $attr      Array or string of attributes.
 *
 * @return string
 */
function wp_kama_get_attachment_link_filter( $link_html, $post, $size, $permalink, $icon, $text, $attr ){

	// filter...
	return $link_html;
}
$link_html(строка)
The page link HTML output.
$post(int|WP_Post)
Post ID or object. Can be 0 for the current global post.
$size(строка|int[])
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
$permalink(true|false)
Whether to add permalink to image.
По умолчанию: false
$icon(true|false)
Whether to include an icon.
$text(строка|false)
If string, will be link text.
$attr(массив|строка)
Array or string of attributes.

Список изменений

С версии 2.7.0 Введена.
С версии 5.1.0 Added the $attr parameter.

Где вызывается хук

wp_get_attachment_link()
wp_get_attachment_link
wp-includes/post-template.php 1680
return apply_filters( 'wp_get_attachment_link', $link_html, $post, $size, $permalink, $icon, $text, $attr );

Где используется хук в WordPress

Использование не найдено.