upgrader_package_options
云策文档标注
概述
upgrader_package_options 是一个 WordPress 过滤器钩子,用于在运行更新前修改包选项。它允许开发者在升级过程中自定义参数,如目标位置、清除设置等。
关键要点
- 过滤器钩子名称为 upgrader_package_options,在 WP_Upgrader::run() 中调用。
- 参数包括 $options 数组,包含包、目标、清除选项、钩子额外参数等。
- 相关钩子有 upgrader_process_complete,用于更新完成后的操作。
- 自 WordPress 4.3.0 版本引入,用于插件、主题或核心更新。
代码示例
$options = apply_filters( 'upgrader_package_options', $options );
原文内容
Filters the package options before running an update.
Description
See also ‘upgrader_process_complete’.
Parameters
$optionsarray- Options used by the upgrader.
packagestringPackage for update.destinationstringUpdate location.clear_destinationboolClear the destination resource.clear_workingboolClear the working resource.abort_if_destination_existsboolAbort if the Destination directory exists.is_multiboolWhether the upgrader is running multiple times.hook_extraarrayExtra hook arguments.actionstringType of action. Default'update'.typestringType of update process. Accepts'plugin','theme', or'core'.bulkboolWhether the update process is a bulk update. Default true.pluginstringPath to the plugin file relative to the plugins directory.themestringThe stylesheet or template name of the theme.language_update_typestringThe language pack update type. Accepts'plugin','theme', or'core'.language_updateobjectThe language pack update offer.
Source
$options = apply_filters( 'upgrader_package_options', $options );Changelog
Version Description 4.3.0 Introduced.
User Contributed Notes
You must log in before being able to contribute a note or feedback.