Automattic\WooCommerce\Internal\TransientFiles
TransientFilesEngine::delete_transient_file()
Delete an existing transient file.
Method of the class: TransientFilesEngine{}
No Hooks.
Return
true|false
. True if the file has been deleted, false otherwise (the file didn't exist).
Usage
$TransientFilesEngine = new TransientFilesEngine(); $TransientFilesEngine->delete_transient_file( $filename ): bool;
- $filename(string) (required)
- The name of the file to delete.
TransientFilesEngine::delete_transient_file() TransientFilesEngine::delete transient file code WC 9.6.1
public function delete_transient_file( string $filename ): bool { $file_path = $this->get_transient_file_path( $filename ); if ( is_null( $file_path ) ) { return false; } $dirname = dirname( $file_path ); wp_delete_file( $file_path ); $this->delete_directory_if_not_empty( $dirname ); return true; }