apply_filters( 'upgrader_pre_download', false|string|WP_Error $reply, string $package, WP_Upgrader $upgrader, array $hook_extra )
- Since
- 3.7.0, 5.5.0
Filters whether to download a package for a WordPress core, plugin, theme, or translation upgrade.
Description
Return a non-false value to short-circuit the download and return that value instead.
Compatibility
- WordPress
- since 5.5.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
$replyfalse|string|WP_Error- Whether to short-circuit the download, the path to the downloaded package, or a WP_Error object. Default false.
$packagestring- The package URI. May be a remote URL or local file path.
$upgraderWP_Upgrader- The WP_Upgrader instance.
$hook_extraarray- Extra arguments passed to hooked filters.
Where this hook fires · 1
wp-admin/includes/class-wp-upgrader.php:322WP_Upgrader::download_package()
Source code
* @param false|string|WP_Error $reply Whether to short-circuit the download, the path to the downloaded package, * or a WP_Error object. Default false. * @param string $package The package URI. May be a remote URL or local file path. * @param WP_Upgrader $upgrader The WP_Upgrader instance. * @param array $hook_extra Extra arguments passed to hooked filters. */ $reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra ); if ( false !== $reply ) { return $reply; } if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { // Local file or remote? return $package; // Must be a local file.Changelog
Introduced in 3.7.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.0.4
Parameter
$reply retyped from bool to false|string|WP_Error.verified against source5.5.0
Added the
$hook_extra parameter.from the docblock3.7.0
Introduced.from the docblock
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.