delete_post_thumbnail()WP 3.3.0

Remove a post thumbnail.

No Hooks.

Return

true|false. True on success, false on failure.

Usage

delete_post_thumbnail( $post );
$post(int|WP_Post) (required)
Post ID or post object from which the thumbnail should be removed.

Examples

0

#1 Remove the thumbnail of the posts

delete_post_thumbnail( 56 );

This function is analogous to such a string:

delete_post_meta( 56, '_thumbnail_id' );

Changelog

Since 3.3.0 Introduced.

delete_post_thumbnail() code WP 6.4.3

function delete_post_thumbnail( $post ) {
	$post = get_post( $post );
	if ( $post ) {
		return delete_post_meta( $post->ID, '_thumbnail_id' );
	}
	return false;
}