钩子文档

mu_dropdown_languages

💡 云策文档标注

概述

mu_dropdown_languages 是一个 WordPress 过滤器钩子,用于修改多站点(MU)环境中下拉菜单中可用的语言选项。它允许开发者自定义语言下拉列表的 HTML 输出。

关键要点

  • 这是一个过滤器钩子,用于过滤多站点语言下拉菜单的内容。
  • 接受三个参数:$output(HTML 输出数组)、$lang_files(可用语言文件数组)和 $current(当前语言代码)。
  • 通过 apply_filters 调用,位于 wp-admin/includes/ms.php 文件中。
  • 从 WordPress MU 3.0.0 版本开始引入。

代码示例

$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );

📄 原文内容

Filters the languages available in the dropdown.

Parameters

$outputstring[]
Array of HTML output for the dropdown.
$lang_filesstring[]
Array of available language files.
$currentstring
The current language code.

Source

$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );

Changelog

Version Description
MU (3.0.0) Introduced.