upgrader_source_selection
云策文档标注
概述
upgrader_source_selection 是一个 WordPress 过滤器钩子,用于在升级过程中修改源文件的位置。它允许开发者在安装包时自定义源文件路径。
关键要点
- 过滤器名称:upgrader_source_selection
- 参数:$source(源文件位置)、$remote_source(远程文件源位置)、$upgrader(WP_Upgrader 实例)、$hook_extra(传递给钩子的额外参数数组)
- 用途:在 WP_Upgrader::install_package() 方法中调用,用于安装包时过滤源文件位置
- 版本历史:从 WordPress 2.8.0 引入,4.4.0 版本添加了 $hook_extra 参数
原文内容
Filters the source file location for the upgrade package.
Parameters
$sourcestring-
File source location.
$remote_sourcestring-
Remote file source location.
$upgraderWP_Upgrader-
WP_Upgrader instance.
$hook_extraarray-
Extra arguments passed to hooked filters.
Source
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );