post_thumbnail_html

过滤钩子
apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr )
参数
  • (string) $html The post thumbnail HTML.
    Required:
  • (int) $post_id The post ID.
    Required:
  • (int) $post_thumbnail_id The post thumbnail ID, or 0 if there isn't one.
    Required:
  • (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).
    Required:
  • (string|array) $attr Query string or array of attributes.
    Required:
定义位置
相关勾子
admin_post_thumbnail_htmlpost_thumbnail_urlpost_thumbnail_idend_fetch_post_thumbnail_htmlpost_thumbnail_size
相关方法
_wp_post_thumbnail_htmlthe_post_thumbnail_urlpost_thumbnail_meta_boxset_post_thumbnailwp_ajax_get_post_thumbnail_htmlhas_post_thumbnail
引入
2.9.0
弃用
-

post_thumbnail_html: 这是WordPress的一个过滤钩子,允许你修改文章缩略图的HTML代码。这个钩子在文章的缩略图生成时被触发,允许你修改或替换默认的HTML代码。

过滤文章缩略图的HTML。

return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr );

常见问题

FAQs
查看更多 >