HTTP/2 301
server: nginx
date: Sat, 11 Oct 2025 11:34:44 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/functions/wp_delete_file/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
HTTP/2 200
server: nginx
date: Sat, 11 Oct 2025 11:34:45 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
wp_delete_file() – Function | Developer.WordPress.org
wp_delete_file( string $file ): bool
$file
string required The path to the file to delete.
bool True on success, false on failure.
function wp_delete_file( $file ) {
/**
* Filters the path of the file to delete.
*
* @since 2.1.0
*
* @param string $file Path to the file to delete.
*/
$delete = apply_filters( 'wp_delete_file', $file );
if ( ! empty( $delete ) ) {
return @unlink( $delete );
}
return false;
}
View all references View on Trac View on GitHub
Version Description 6.7.0 A return value was added. 4.2.0 Introduced.
User Contributed Notes