Title: WordPress function for deleting a file
Last modified: August 19, 2016

---

# WordPress function for deleting a file

 *  [fraticiudan](https://wordpress.org/support/users/fraticiudan/)
 * (@fraticiudan)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/wordpress-function-for-deleting-a-file/)
 * Hello,
 * I have an upload field in an option page. I use the [wp_upload_bits](http://codex.wordpress.org/Function_Reference/wp_upload_bits)
   function to upload the file, which goes to wp-content/upload/[year]/[month]/[
   filename]. Great.
 * But I failed to find a function that deletes this file, preferably based on the
   file URL, so that I don’t have to save the local path as well. I noticed that
   wordpress only saves the url of it’s attachments so I goes there is such a function.
   Any directions is greatly appreciated.

Viewing 1 replies (of 1 total)

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/wordpress-function-for-deleting-a-file/#post-1698526)
 * there isn’t one, it looks like all the deletes are handled by the standard unlink.
   Which I believe can’t be done via a url (for obvious reasons).

Viewing 1 replies (of 1 total)

The topic ‘WordPress function for deleting a file’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: Anonymous User
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/wordpress-function-for-deleting-a-file/#post-1698526)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
