admin_post_thumbnail_size
云策文档标注
概述
admin_post_thumbnail_size 过滤器用于控制‘特色图像’元框中显示的缩略图尺寸。它允许开发者自定义尺寸,支持注册的图像尺寸名称或像素数组。
关键要点
- 过滤器名称:admin_post_thumbnail_size
- 用途:过滤‘特色图像’元框中的缩略图显示尺寸
- 参数:$size(字符串或数组)、$thumbnail_id(整数)、$post(WP_Post 对象)
- 主题支持‘post-thumbnail’时会注册特殊尺寸,不同于‘thumbnail’尺寸
- 相关函数:_wp_post_thumbnail_html() 用于生成元框 HTML
- 引入版本:4.4.0
原文内容
Filters the size used to display the post thumbnail image in the ‘Featured image’ meta box.
Description
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.
Parameters
$sizestring|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_idint-
Post thumbnail attachment ID.
$postWP_Post-
The post object associated with the thumbnail.
Source
$size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |