has_post_thumbnail

过滤钩子
apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id )
参数
  • (bool) $has_thumbnail true if the post has a post thumbnail, otherwise false.
    Required:
  • (int|WP_Post|null) $post Post ID or WP_Post object. Default is global `$post`.
    Required:
  • (int|false) $thumbnail_id Post thumbnail ID or false if the post does not exist.
    Required:
定义位置
相关勾子
post_thumbnail_idpost_thumbnail_urlpost_thumbnail_sizepost_thumbnail_htmladmin_post_thumbnail_size
相关方法
has_post_thumbnailthe_post_thumbnailset_post_thumbnailthe_post_thumbnail_urlget_the_post_thumbnailset_post_thumbnail_size
引入
5.1.0
弃用
-

has_post_thumbnail – 这个函数用来检查一个文章是否有一个特色图片,也称为缩略图。它返回一个布尔值,表明该文章是否有特色图片。

过滤有文章缩略图的文章。

return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );

常见问题

FAQs
查看更多 >