Use API instead of SELECT. see #4189
git-svn-id: https://develop.svn.wordpress.org/trunk@5586 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ac1db497fc
commit
c4bb18caa6
@ -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
Block a user