钩子文档

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.
  • package string
    Package for update.
  • destination string
    Update location.
  • clear_destination bool
    Clear the destination resource.
  • clear_working bool
    Clear the working resource.
  • abort_if_destination_exists bool
    Abort if the Destination directory exists.
  • is_multi bool
    Whether the upgrader is running multiple times.
  • hook_extra array
    Extra hook arguments.
    • action string
      Type of action. Default 'update'.
    • type string
      Type of update process. Accepts 'plugin', 'theme', or 'core'.
    • bulk bool
      Whether the update process is a bulk update. Default true.
    • plugin string
      Path to the plugin file relative to the plugins directory.
    • theme string
      The stylesheet or template name of the theme.
    • language_update_type string
      The language pack update type. Accepts 'plugin', 'theme', or 'core'.
    • language_update object
      The language pack update offer.

Source

$options = apply_filters( 'upgrader_package_options', $options );

Changelog

VersionDescription
4.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.