钩子文档

signup_get_available_languages

💡 云策文档标注

概述

signup_get_available_languages 是一个 WordPress 过滤器钩子,用于在前端站点注册时过滤可用语言列表。通过此钩子,开发者可以自定义或禁用注册表单中的语言设置选项。

关键要点

  • 此钩子过滤前端站点注册的可用语言列表,参数为语言代码数组。
  • 传递空数组将禁用注册表单中的语言设置,创建站点时使用默认语言。
  • 未安装的语言将被自动移除,确保语言代码有效。
  • 钩子从 WordPress 4.4.0 版本引入,相关函数为 signup_get_available_languages()。

代码示例

$languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );

📄 原文内容

Filters the list of available languages for front-end site sign-ups.

Description

Passing an empty array to this hook will disable output of the setting on the sign-up form, and the default language will be used when creating the site.

Languages not already installed will be stripped.

Parameters

$languagesstring[]
Array of available language codes. Language codes are formed by stripping the .mo extension from the language file names.

Source

$languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );

Changelog

Version Description
4.4.0 Introduced.