Support

Account

Home Forums Backend Issues (wp-admin) How to automatically detach a file from a post (deleted via edit post)? Reply To: How to automatically detach a file from a post (deleted via edit post)?

  • If you can get the attachment ID, you might be able to use:
    wp_delete_attachment( $attachment->ID, 'true' );