signup_get_available_languages

函数
signup_get_available_languages ( No parameters )
返回值
  • (string[]) Array of available language codes. Language codes are formed by stripping the .mo extension from the language file names.
相关
  • get_available_languages()
定义位置
相关方法
get_available_languageswp_get_available_translationsget_available_post_statusesis_upload_space_availablewp_maybe_grant_install_languages_cap
引入
4.4.0
弃用
-

signup_get_available_languages: 这个函数用来获取一个WordPress多站点安装的新博客的可用语言列表: 这个函数不需要任何参数,它将返回一个可用语言的数组。

检索网站/用户注册过程中的可用语言。

function signup_get_available_languages() {
	/**
	 * Filters the list of available languages for front-end site sign-ups.
	 *
	 * 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.
	 *
	 * @since 4.4.0
	 *
	 * @param string[] $languages Array of available language codes. Language codes are formed by
	 *                            stripping the .mo extension from the language file names.
	 */
	$languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );

	/*
	 * Strip any non-installed languages and return.
	 *
	 * Re-call get_available_languages() here in case a language pack was installed
	 * in a callback hooked to the 'signup_get_available_languages' filter before this point.
	 */
	return array_intersect_assoc( $languages, get_available_languages() );
}

常见问题

FAQs
查看更多 >