From c09ea055430e6b083fb6328f98180d55a950cbaf Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 29 May 2007 04:26:36 +0000 Subject: [PATCH] Use API instead of SELECT. see #4189 git-svn-id: http://svn.automattic.com/wordpress/trunk@5586 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index c703d116e8..0983bab992 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1365,12 +1365,13 @@ function wp_delete_attachment($postid) { $meta = wp_get_attachment_metadata( $postid ); $file = get_attached_file( $postid ); + // TODO delete for pluggable post taxonomies too + wp_delete_object_term_relationships($postid, array('category', 'post_tag')); + $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = '$postid'"); $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = '$postid'"); - $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = '$postid'"); - $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '$postid'"); if ( ! empty($meta['thumb']) ) {