delete_post_thumbnail

函数
delete_post_thumbnail ( $post )
参数
  • (int|WP_Post) $post Post ID or post object from which the thumbnail should be removed.
    Required:
返回值
  • (bool) True on success, false on failure.
定义位置
相关方法
the_post_thumbnailset_post_thumbnailget_the_post_thumbnailget_post_thumbnail_idthe_post_thumbnail_url
引入
3.3.0
弃用
-

delete_post_thumbnail: 此函数删除特定文章的特色图片(文章缩略图)。

从给定的文章中删除缩略图(特色图片)。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function delete_post_thumbnail( $post ) {
$post = get_post( $post );
if ( $post ) {
return delete_post_meta( $post->ID, '_thumbnail_id' );
}
return false;
}
function delete_post_thumbnail( $post ) { $post = get_post( $post ); if ( $post ) { return delete_post_meta( $post->ID, '_thumbnail_id' ); } return false; }
function delete_post_thumbnail( $post ) {
	$post = get_post( $post );
	if ( $post ) {
		return delete_post_meta( $post->ID, '_thumbnail_id' );
	}
	return false;
}

常见问题

FAQs
查看更多 >