函数原型
delete_post_thumbnail( int|WP_Post $post ): bool
函数描述
Removes the thumbnail (featured image) from the given post.
是否弃用
未弃用
函数参数
-
$post
int|WP_Post
Required - Post ID or post object from which the thumbnail should be removed.
函数返回值
bool True on success, false on failure.
函数位置
File: wp-includes/post.php.
函数源码
function delete_post_thumbnail( $post ) {
$post = get_post( $post );
if ( $post ) {
return delete_post_meta( $post->ID, '_thumbnail_id' );
}
return false;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |

