post_thumbnail_url

过滤钩子
apply_filters( 'post_thumbnail_url', $thumbnail_url, $post, $size )
参数
  • (string|false) $thumbnail_url Post thumbnail URL or false if the post does not exist.
    Required:
  • (int|WP_Post|null) $post Post ID or WP_Post object. Default is global `$post`.
    Required:
  • (string|int[]) $size Registered image size to retrieve the source for or a flat array of height and width dimensions. Default 'post-thumbnail'.
    Required:
定义位置
相关勾子
post_thumbnail_idpost_thumbnail_htmlpost_thumbnail_sizehas_post_thumbnailadmin_post_thumbnail_html
相关方法
the_post_thumbnail_urlget_the_post_thumbnail_url_wp_post_thumbnail_htmlthe_post_thumbnailset_post_thumbnailhas_post_thumbnail
引入
5.9.0
弃用
-

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

过滤缩略图后的URL。

return apply_filters( 'post_thumbnail_url', $thumbnail_url, $post, $size );

常见问题

FAQs
查看更多 >