wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_delete_file › WordPress Function

Since4.2.0
Deprecatedn/a
wp_delete_file ( $file )
Parameters:
  • (string) $file The path to the file to delete.
    Required: Yes
Returns:
  • (bool) True on success, false on failure.
Defined at:
Codex:
Change Log:
  • 6.7.0

Deletes a file.



Source

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;
}