wppaste
WordPress

apply_filters( 'unzip_file', true|WP_Error $result, string $file, string $to, string[] $needed_dirs, float $required_space )

Since
6.4.0
Filters the result of unzipping an archive.

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

$resulttrue|WP_Error
The result of unzipping the archive. True on success, otherwise WP_Error. Default true.
$filestring
Full path and filename of ZIP archive.
$tostring
Full path on the filesystem the archive was extracted to.
$needed_dirsstring[]
A full list of required folders that were 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:1853_unzip_file_ziparchive()
  • wp-admin/includes/file.php:2000_unzip_file_pclzip()

Source code

	 * @param true|WP_Error $result         The result of unzipping the archive. True on success, otherwise WP_Error. Default true.	 * @param string        $file           Full path and filename of ZIP archive.	 * @param string        $to             Full path on the filesystem the archive was extracted to.	 * @param string[]      $needed_dirs    A full list of required folders that were created.	 * @param float         $required_space The space required to unzip the file and copy its contents, with a 10% buffer.	 */	$result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space ); 	unset( $needed_dirs ); 	return $result;}

Changelog

Introduced in 6.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 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.