Make WordPress Core

Ticket #17895: 17895-function.diff

File 17895-function.diff, 732 bytes (added by CoenJacobs, 13 years ago)

delete_post_thumbnail() function isn't that hard

  • post.php

     
    51905190}
    51915191
    51925192/**
     5193 * Removes a post thumbnail.
     5194 *
     5195 * @param int|object $post Post ID or object where thumbnail should be removed from.
     5196 * @return bool True on success, false on failure.
     5197 */
     5198function delete_post_thumbnail( $post ) {
     5199        $post = get_post( $post );
     5200        if ( $post ) {
     5201                $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
     5202                if ( ! empty( $thumbnail_id ) ) {
     5203                        delete_post_meta( $post->ID, '_thumbnail_id' );
     5204                        return true;
     5205                }
     5206                return true;
     5207        }
     5208        return false;
     5209}
     5210
     5211/**
    51935212 * Returns a link to a post format index.
    51945213 *
    51955214 * @since 3.1.0