钩子文档

load_script_translation_file

💡 云策文档标注

概述

load_script_translation_file 是一个 WordPress 过滤器,用于修改加载脚本翻译文件的路径。它允许开发者自定义特定脚本句柄和文本域的翻译文件位置。

关键要点

  • 过滤器名称:load_script_translation_file
  • 参数:$file(翻译文件路径或 false)、$handle(脚本句柄)、$domain(文本域)
  • 用途:过滤脚本翻译文件的加载路径,支持自定义翻译文件位置
  • 相关函数:load_script_translations() 用于加载翻译数据
  • 引入版本:WordPress 5.0.2

📄 原文内容

Filters the file path for loading script translations for the given script handle and text domain.

Parameters

$filestring|false
Path to the translation file to load. False if there isn’t one.
$handlestring
Name of the script to register a translation domain to.
$domainstring
The text domain.

Source

$file = apply_filters( 'load_script_translation_file', $file, $handle, $domain );

Changelog

Version Description
5.0.2 Introduced.