delete_post_thumbnail

Remove a post thumbnail.

Description

delete_post_thumbnail( (int|WP_Post) $post ); 

Parameters (1)

0. $post (int|WP_Post)
Post ID or post object where thumbnail should be removed from.

Usage

  1. if ( !function_exists( 'delete_post_thumbnail' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // Post ID or post object where thumbnail should be removed from. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = delete_post_thumbnail($post); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function delete_post_thumbnail( $post ) { 
  2. $post = get_post( $post ); 
  3. if ( $post ) 
  4. return delete_post_meta( $post->ID, '_thumbnail_id' ); 
  5. return false;