WordPress开发者和主题制作者的搜索引擎



get_post_thumbnail_id ›

Since2.9.0
已弃用n/a
get_post_thumbnail_id ( $post = null )
参数:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global `$post`.
    Required: No
    默认: null
返回:
  • (string|int) Post thumbnail ID or empty string.
定义在:
文档:
Change Log:
  • 4.4.0

Retrieve post thumbnail ID.



源码

function get_post_thumbnail_id( $post = null ) {
	$post = get_post( $post );
	if ( ! $post ) {
		return '';
	}
	return get_post_meta( $post->ID, '_thumbnail_id', true );
}