begin_fetch_post_thumbnail_html
Action HookDescription
Fires before fetching the post thumbnail HTML. Provides "just in time" filtering of all filters in wp_get_attachment_image().Hook Information
File Location |
wp-includes/post-thumbnail-template.php
View on GitHub
|
Hook Type | Action |
Line Number | 200 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$post_id
|
The post ID. |
int
|
$post_thumbnail_id
|
The post thumbnail ID. |
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). |
Usage Examples
Basic Usage
<?php
// Hook into begin_fetch_post_thumbnail_html
add_action('begin_fetch_post_thumbnail_html', 'my_custom_function', 10, 3);
function my_custom_function($post_id, $post_thumbnail_id, $size) {
// Your custom code here
}
Source Code Context
wp-includes/post-thumbnail-template.php:200
- How this hook is used in WordPress core
<?php
195 * @param int $post_id The post ID.
196 * @param int $post_thumbnail_id The post thumbnail ID.
197 * @param string|int[] $size Requested image size. Can be any registered image size name, or
198 * an array of width and height values in pixels (in that order).
199 */
200 do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
201
202 if ( in_the_loop() ) {
203 update_post_thumbnail_cache();
204 }
205
PHP Documentation
<?php
/**
* Fires before fetching the post thumbnail HTML.
*
* Provides "just in time" filtering of all filters in wp_get_attachment_image().
*
* @since 2.9.0
*
* @param int $post_id The post ID.
* @param int $post_thumbnail_id The post thumbnail ID.
* @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).
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-includes/post-thumbnail-template.php
Related Hooks
Related hooks will be displayed here in future updates.