钩子文档

themes_update_check_locales

💡 云策文档标注

概述

本文档介绍 themes_update_check_locales 过滤器,用于过滤主题翻译请求的区域设置。该过滤器在检查主题更新时被调用,允许开发者自定义要请求翻译的区域设置列表。

关键要点

  • 过滤器名称:themes_update_check_locales
  • 参数:$locales(字符串数组),表示主题区域设置,默认值为站点所有可用区域设置
  • 用途:在 wp_update_themes() 函数中调用,用于检查主题更新时指定翻译请求的区域设置
  • 版本历史:从 WordPress 4.5.0 起,$locales 参数默认值改为包含所有区域设置;最初在 3.7.0 版本引入

📄 原文内容

Filters the locales requested for theme translations.

Parameters

$localesstring[]
Theme locales. Default is all available locales of the site.

Source

$locales = apply_filters( 'themes_update_check_locales', $locales );

Changelog

Version Description
4.5.0 The default value of the $locales parameter changed to include all locales.
3.7.0 Introduced.