pre_unzip_file
Filters archive unzipping to override with a custom process.
Использование
add_filter( 'pre_unzip_file', 'wp_kama_pre_unzip_file_filter', 10, 5 );
/**
* Function for `pre_unzip_file` filter-hook.
*
* @param null|true|WP_Error $result The result of the override. True on success, otherwise WP Error.
* @param string $file Full path and filename of ZIP archive.
* @param string $to Full path on the filesystem to extract archive to.
* @param string[] $needed_dirs A full list of required folders that need to be created.
* @param float $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
*
* @return null|true|WP_Error
*/
function wp_kama_pre_unzip_file_filter( $result, $file, $to, $needed_dirs, $required_space ){
// filter...
return $result;
}
- $result(null|true|WP_Error)
- The result of the override. True on success, otherwise WP Error.
По умолчанию: null - $file(строка)
- Full path and filename of ZIP archive.
- $to(строка)
- Full path on the filesystem to extract archive to.
- $needed_dirs(string[])
- A full list of required folders that need to be created.
- $required_space(float)
- The space required to unzip the file and copy its contents, with a 10% buffer.
Список изменений
| С версии 6.4.0 | Введена. |
Где вызывается хук
pre_unzip_file
pre_unzip_file
wp-admin/includes/file.php 1792
$pre = apply_filters( 'pre_unzip_file', null, $file, $to, $needed_dirs, $required_space );
wp-admin/includes/file.php 1963
$pre = apply_filters( 'pre_unzip_file', null, $file, $to, $needed_dirs, $required_space );