WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/24/2012 03:24:31 PM (8 years ago)
Author:
nacin
Message:

Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r20271 r20287  
    20542054
    20552055    do_action( 'delete_post', $postid );
    2056     $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
     2056    $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
    20572057    do_action( 'deleted_post', $postid );
    20582058
     
    38113811    wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
    38123812
    3813     $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id ));
     3813    $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_thumbnail_id' , 'meta_value' => $post_id ) );
    38143814
    38153815    $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
     
    38303830
    38313831    do_action( 'delete_post', $post_id );
    3832     $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id ));
     3832    $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
    38333833    do_action( 'deleted_post', $post_id );
    38343834
Note: See TracChangeset for help on using the changeset viewer.