W3cubDocs

/WordPress

delete_post_thumbnail( int|WP_Post $post ): bool

Removes the thumbnail (featured image) from the given post.

Parameters

$postint|WP_Postrequired
Post ID or post object from which the thumbnail should be removed.

Return

bool True on success, false on failure.

Source

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

Changelog

Version Description
3.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/delete_post_thumbnail