post_thumbnail_html
Filters the post thumbnail HTML.
Usage
add_filter( 'post_thumbnail_html', 'wp_kama_post_thumbnail_html_filter', 10, 5 ); /** * Function for `post_thumbnail_html` filter-hook. * * @param string $html The post thumbnail HTML. * @param int $post_id The post ID. * @param int $post_thumbnail_id The post thumbnail ID, or 0 if there isn't one. * @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 string|array $attr Query string or array of attributes. * * @return string */ function wp_kama_post_thumbnail_html_filter( $html, $post_id, $post_thumbnail_id, $size, $attr ){ // filter... return $html; }
- $html(string)
- The post thumbnail HTML.
- $post_id(int)
- The post ID.
- $post_thumbnail_id(int)
- The post thumbnail ID, or 0 if there isn't one.
- $size(string|int[])
- Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
- $attr(string|array)
- Query string or array of attributes.
Changelog
Since 2.9.0 | Introduced. |
Where the hook is called
wp-includes/post-thumbnail-template.php 219
return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr );