Filter hook 'upgrader_pre_install'

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

View Source

upgrader_pre_install

Filter Hook
Description
Filters the installation response before the installation has started. Returning a value that could be evaluated as a `WP_Error` will effectively short-circuit the installation, returning that value instead.

Hook Information

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

Hook Parameters

Type Name Description
bool|WP_Error $response Installation response.
array $hook_extra Extra arguments passed to hooked filters.

Usage Examples

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

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

Source Code Context

wp-admin/includes/class-wp-upgrader.php:556 - How this hook is used in WordPress core
<?php
 551  		 * @since 2.8.0
 552  		 *
 553  		 * @param bool|WP_Error $response   Installation response.
 554  		 * @param array         $hook_extra Extra arguments passed to hooked filters.
 555  		 */
 556  		$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
 557  
 558  		if ( is_wp_error( $res ) ) {
 559  			return $res;
 560  		}
 561  

PHP Documentation

<?php
/**
		 * Filters the installation response before the installation has started.
		 *
		 * Returning a value that could be evaluated as a `WP_Error` will effectively
		 * short-circuit the installation, returning that value instead.
		 *
		 * @since 2.8.0
		 *
		 * @param bool|WP_Error $response   Installation response.
		 * @param array         $hook_extra Extra arguments passed to hooked filters.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/class-wp-upgrader.php
Related Hooks

Related hooks will be displayed here in future updates.