wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_delete_file › WordPress Function

Since4.2.0
已弃用n/a
› wp_delete_file ( $file )
参数:
  • (string) $file The path to the file to delete.
    Required: Yes
返回:
  • (bool) True on success, false on failure.
定义在:
文档:
Change Log:
  • 6.7.0

Deletes a file.



源码

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