unzip_file_use_ziparchive
Filter HookDescription
Filters whether to use ZipArchive to unzip archives.Hook Information
File Location |
wp-admin/includes/file.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1650 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$ziparchive
|
Whether to use ZipArchive. Default true. |
Usage Examples
Basic Usage
<?php
// Hook into unzip_file_use_ziparchive
add_filter('unzip_file_use_ziparchive', 'my_custom_filter', 10, 1);
function my_custom_filter($ziparchive) {
// Your custom filtering logic here
return $ziparchive;
}
Source Code Context
wp-admin/includes/file.php:1650
- How this hook is used in WordPress core
<?php
1645 *
1646 * @since 3.0.0
1647 *
1648 * @param bool $ziparchive Whether to use ZipArchive. Default true.
1649 */
1650 if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
1651 $result = _unzip_file_ziparchive( $file, $to, $needed_dirs );
1652 if ( true === $result ) {
1653 return $result;
1654 } elseif ( is_wp_error( $result ) ) {
1655 if ( 'incompatible_archive' !== $result->get_error_code() ) {
PHP Documentation
<?php
/**
* Filters whether to use ZipArchive to unzip archives.
*
* @since 3.0.0
*
* @param bool $ziparchive Whether to use ZipArchive. Default true.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-admin/includes/file.php
Related Hooks
Related hooks will be displayed here in future updates.