Filter hook 'upgrader_pre_download'

in WP Core File wp-admin/includes/class-wp-upgrader.php at line 320

View Source

upgrader_pre_download

Filter Hook
Description
Filters whether to return the package.

Hook Information

File Location wp-admin/includes/class-wp-upgrader.php View on GitHub
Hook Type Filter
Line Number 320

Hook Parameters

Type Name Description
bool $reply Whether to bail without returning the package. Default false.
string $package The package file name.
WP_Upgrader $upgrader The WP_Upgrader instance.
array $hook_extra Extra arguments passed to hooked filters.

Usage Examples

Basic Usage
<?php
// Hook into upgrader_pre_download
add_filter('upgrader_pre_download', 'my_custom_filter', 10, 4);

function my_custom_filter($reply, $package, $upgrader, $hook_extra) {
    // Your custom filtering logic here
    return $reply;
}

Source Code Context

wp-admin/includes/class-wp-upgrader.php:320 - How this hook is used in WordPress core
<?php
 315  		 *                                Default false.
 316  		 * @param string      $package    The package file name.
 317  		 * @param WP_Upgrader $upgrader   The WP_Upgrader instance.
 318  		 * @param array       $hook_extra Extra arguments passed to hooked filters.
 319  		 */
 320  		$reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra );
 321  		if ( false !== $reply ) {
 322  			return $reply;
 323  		}
 324  
 325  		if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { // Local file or remote?

PHP Documentation

<?php
/**
		 * Filters whether to return the package.
		 *
		 * @since 3.7.0
		 * @since 5.5.0 Added the `$hook_extra` parameter.
		 *
		 * @param bool        $reply      Whether to bail without returning the package.
		 *                                Default false.
		 * @param string      $package    The package file name.
		 * @param WP_Upgrader $upgrader   The WP_Upgrader instance.
		 * @param array       $hook_extra Extra arguments passed to hooked filters.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-admin/includes/class-wp-upgrader.php
Related Hooks

Related hooks will be displayed here in future updates.