load_script_translations
云策文档标注
概述
load_script_translations 是一个 WordPress 过滤器,用于在加载脚本翻译数据时进行干预。它允许开发者修改或过滤特定脚本的翻译内容。
关键要点
- 这是一个过滤器,用于处理脚本翻译数据。
- 参数包括翻译数据、文件路径、脚本句柄和文本域。
- 在 WordPress 5.0.2 版本中引入。
代码示例
apply_filters( 'load_script_translations', $translations, $file, $handle, $domain );注意事项
此过滤器与 load_script_translations() 函数相关,用于加载翻译数据。
原文内容
Filters script translations for the given file, script handle and text domain.
Parameters
$translationsstring-
JSON-encoded translation data.
$filestring-
Path to the translation file that was loaded.
$handlestring-
Name of the script to register a translation domain to.
$domainstring-
The text domain.
Source
return apply_filters( 'load_script_translations', $translations, $file, $handle, $domain );
Changelog
| Version | Description |
|---|---|
| 5.0.2 | Introduced. |