upgrader_source_selection хук-фильтрWP 2.8.0

Filters the source file location for the upgrade package.

Использование

add_filter( 'upgrader_source_selection', 'wp_kama_upgrader_source_selection_filter', 10, 4 );

/**
 * Function for `upgrader_source_selection` filter-hook.
 * 
 * @param string      $source        File source location.
 * @param string      $remote_source Remote file source location.
 * @param WP_Upgrader $upgrader      WP_Upgrader instance.
 * @param array       $hook_extra    Extra arguments passed to hooked filters.
 *
 * @return string
 */
function wp_kama_upgrader_source_selection_filter( $source, $remote_source, $upgrader, $hook_extra ){

	// filter...
	return $source;
}
$source(строка)
File source location.
$remote_source(строка)
Remote file source location.
$upgrader(WP_Upgrader)
WP_Upgrader instance.
$hook_extra(массив)
Extra arguments passed to hooked filters.

Список изменений

С версии 2.8.0 Введена.
С версии 4.4.0 The $hook_extra parameter became available.

Где вызывается хук

WP_Upgrader::install_package()
upgrader_source_selection
wp-admin/includes/class-wp-upgrader.php 528
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );

Где используется хук в WordPress

wp-admin/includes/class-language-pack-upgrader.php 201
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );
wp-admin/includes/class-language-pack-upgrader.php 302
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
wp-admin/includes/class-plugin-upgrader.php 128
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
wp-admin/includes/class-plugin-upgrader.php 149
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
wp-admin/includes/class-theme-upgrader.php 240
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
wp-admin/includes/class-theme-upgrader.php 262
remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );