钩子文档

pre_auto_update

💡 云策文档标注

概述

pre_auto_update 是一个 WordPress 动作钩子,在自动更新执行前触发,用于在更新过程中进行干预或检查。

关键要点

  • 触发时机:在自动更新(包括核心、主题、插件或翻译)开始前立即执行。
  • 参数:$type(更新类型字符串)、$item(更新对象)、$context(文件系统上下文路径)。
  • 用途:允许开发者通过添加自定义函数来检查或修改自动更新行为。
  • 相关函数:由 WP_Automatic_Updater::update() 调用,用于在适当时更新项目。
  • 版本历史:从 WordPress 4.4.0 版本引入。

📄 原文内容

Fires immediately prior to an auto-update.

Parameters

$typestring
The type of update being checked: 'core', 'theme', 'plugin', or 'translation'.
$itemobject
The update offer.
$contextstring
The filesystem context (a path) against which filesystem access and status should be checked.

Source

do_action( 'pre_auto_update', $type, $item, $context );

Changelog

Version Description
4.4.0 Introduced.