钩子文档

async_update_translation

💡 云策文档标注

概述

async_update_translation 是一个 WordPress 过滤器,用于控制是否异步更新核心、插件或主题的翻译。它允许开发者干预语言包的升级过程。

关键要点

  • 这是一个过滤器,用于决定是否异步更新翻译。
  • 接受两个参数:$update(布尔值,表示是否更新)和 $language_update(对象,包含更新信息)。
  • 在 Language_Pack_Upgrader::async_upgrade() 方法中使用,用于在其他升级完成后异步升级语言包。
  • 自 WordPress 4.0.0 版本引入。

代码示例

$update = apply_filters( 'async_update_translation', $update, $language_update );

📄 原文内容

Filters whether to asynchronously update translation for core, a plugin, or a theme.

Parameters

$updatebool
Whether to update.
$language_updateobject
The update offer.

Source

$update = apply_filters( 'async_update_translation', $update, $language_update );

Changelog

Version Description
4.0.0 Introduced.