[wp-hackers] Delete Row - Refreshes Page but not DB
jdg at codesymphony.co
Sun Oct 20 17:02:00 UTC 2013
> $del_image = wp_delete_attachment( $file, true );
> I think it would be smarter to convert that to an sql query (maybe wordpress
> wont catch it as a delete post function in sql?)
You want to use wp_delete_attachment(), not a custom query. The function does a lot more than a single query, it cleans out all of the attachment's data from the data base, and delete's the image files if there are any.
Are you sure that wp_delete_attachment() is actually being called? Are you sure it isn't failing before then somewhere?
More information about the wp-hackers