apply_filters( 'pre_unzip_file', null|true|WP_Error $result, string $file, string $to, string[] $needed_dirs, float $required_space )
- Since
- 6.4.0
Filters archive unzipping to override with a custom process.
Compatibility
- WordPress
- since 6.4.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$resultnull|true|WP_Error- The result of the override. True on success, otherwise WP Error. Default null.
$filestring- Full path and filename of ZIP archive.
$tostring- Full path on the filesystem to extract archive to.
$needed_dirsstring[]- A full list of required folders that need to be created.
$required_spacefloat- The space required to unzip the file and copy its contents, with a 10% buffer.
Where this hook fires · 2
wp-admin/includes/file.php:1797_unzip_file_ziparchive()wp-admin/includes/file.php:1973_unzip_file_pclzip()
Source code
* @param null|true|WP_Error $result The result of the override. True on success, otherwise WP Error. Default null. * @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. */ $pre = apply_filters( 'pre_unzip_file', null, $file, $to, $needed_dirs, $required_space ); if ( null !== $pre ) { // Ensure the ZIP file archive has been closed. $z->close(); return $pre;Changelog
Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.