upgrader_pre_install
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.
Использование
add_filter( 'upgrader_pre_install', 'wp_kama_upgrader_pre_install_filter', 10, 2 );
/**
* Function for `upgrader_pre_install` filter-hook.
*
* @param bool|WP_Error $response Installation response.
* @param array $hook_extra Extra arguments passed to hooked filters.
*
* @return bool|WP_Error
*/
function wp_kama_upgrader_pre_install_filter( $response, $hook_extra ){
// filter...
return $response;
}
- $response(true|false|WP_Error)
- Installation response.
- $hook_extra(массив)
- Extra arguments passed to hooked filters.
Список изменений
| С версии 2.8.0 | Введена. |
Где вызывается хук
wp-admin/includes/class-wp-upgrader.php 555
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
Где используется хук в WordPress
wp-admin/includes/class-plugin-upgrader.php 211
add_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ), 10, 2 );
wp-admin/includes/class-plugin-upgrader.php 212
add_filter( 'upgrader_pre_install', array( $this, 'active_before' ), 10, 2 );
wp-admin/includes/class-plugin-upgrader.php 245
remove_filter( 'upgrader_pre_install', array( $this, 'deactivate_plugin_before_upgrade' ) );
wp-admin/includes/class-plugin-upgrader.php 246
remove_filter( 'upgrader_pre_install', array( $this, 'active_before' ) );
wp-admin/includes/class-theme-upgrader.php 316
add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
wp-admin/includes/class-theme-upgrader.php 344
remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) );
wp-admin/includes/class-theme-upgrader.php 396
add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
wp-admin/includes/class-theme-upgrader.php 526
remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) );