delete_post_thumbnail()
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
#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() delete post thumbnail code WP 6.7.1
function delete_post_thumbnail( $post ) { $post = get_post( $post ); if ( $post ) { return delete_post_meta( $post->ID, '_thumbnail_id' ); } return false; }