钩子文档

update_feedback

💡 云策文档标注

概述

update_feedback 是一个 WordPress 核心更新过程中用于过滤反馈消息的过滤器。它在核心升级的不同阶段被调用,允许开发者自定义显示给用户的更新状态信息。

关键要点

  • update_feedback 过滤器在核心更新流程中多次触发,包括下载解压后、升级开始前、维护模式启用前后、文件复制前和数据库升级前。
  • 参数 $feedback 是一个字符串,代表当前的更新反馈消息,开发者可以修改此消息以提供更定制化的用户体验。
  • 该过滤器在 WordPress 2.5.0 版本中引入,常用于 Core_Upgrader::upgrade() 和 update_core() 函数中。

代码示例

apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );

📄 原文内容

Filters feedback messages displayed during the core update process.

Description

The filter is first evaluated after the zip file for the latest version has been downloaded and unzipped. It is evaluated five more times during the process:

  1. Before WordPress begins the core upgrade process.
  2. Before Maintenance Mode is enabled.
  3. Before WordPress begins copying over the necessary files.
  4. Before Maintenance Mode is disabled.
  5. Before the database is upgraded.

Parameters

$feedbackstring
The core update feedback messages.

Source

apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );

Changelog

Version Description
2.5.0 Introduced.