admin_post_thumbnail_size
Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size is registered, which differs from the 'thumbnail' image size managed via the Settings > Media screen.
Использование
add_filter( 'admin_post_thumbnail_size', 'wp_kama_admin_post_thumbnail_size_filter', 10, 3 );
/**
* Function for `admin_post_thumbnail_size` filter-hook.
*
* @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 int $thumbnail_id Post thumbnail attachment ID.
* @param WP_Post $post The post object associated with the thumbnail.
*
* @return string|int[]
*/
function wp_kama_admin_post_thumbnail_size_filter( $size, $thumbnail_id, $post ){
// filter...
return $size;
}
- $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).
- $thumbnail_id(int)
- Post thumbnail attachment ID.
- $post(WP_Post)
- The post object associated with the thumbnail.
Список изменений
| С версии 4.4.0 | Введена. |
Где вызывается хук
admin_post_thumbnail_size
wp-admin/includes/post.php 1678
$size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );