Use API instead of SELECT. see #4189
git-svn-id: http://svn.automattic.com/wordpress/trunk@5586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
13a01467dc
commit
c09ea05543
|
@ -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']) ) {
|
||||
|
|
Loading…
Reference in New Issue