wp_get_attachment_url
Filters the attachment URL.
Использование
add_filter( 'wp_get_attachment_url', 'wp_kama_get_attachment_url_filter', 10, 2 ); /** * Function for `wp_get_attachment_url` filter-hook. * * @param string $url URL for the given attachment. * @param int $attachment_id Attachment post ID. * * @return string */ function wp_kama_get_attachment_url_filter( $url, $attachment_id ){ // filter... return $url; }
- $url(строка)
- URL for the given attachment.
- $attachment_id(int)
- Attachment post ID.
Список изменений
С версии 2.1.0 | Введена. |
Где вызывается хук
wp_get_attachment_url
wp-includes/post.php 6886
$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );