Make WordPress Core

Changeset 18767


Ignore:
Timestamp:
09/24/2011 07:31:38 PM (13 years ago)
Author:
nacin
Message:

delete_post_thumbnail(). props CoenJacobs, duck_. fixes #17895.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r18709 r18767  
    14741474
    14751475    if ( $thumbnail_id == '-1' ) {
    1476         delete_post_meta( $post_ID, '_thumbnail_id' );
    1477         die( _wp_post_thumbnail_html() );
     1476        if ( delete_post_thumbnail( $post_ID ) )
     1477            die( _wp_post_thumbnail_html() );
     1478        else
     1479            die( '0' );
    14781480    }
    14791481
  • trunk/wp-includes/post.php

    r18753 r18767  
    51925192
    51935193/**
     5194 * Removes a post thumbnail.
     5195 *
     5196 * @since 3.3.0
     5197 *
     5198 * @param int|object $post Post ID or object where thumbnail should be removed from.
     5199 * @return bool True on success, false on failure.
     5200 */
     5201function delete_post_thumbnail( $post ) {
     5202    $post = get_post( $post );
     5203    if ( $post )
     5204        return delete_post_meta( $post->ID, '_thumbnail_id' );
     5205    return false;
     5206}
     5207
     5208/**
    51945209 * Returns a link to a post format index.
    51955210 *
Note: See TracChangeset for help on using the changeset viewer.