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多站點安裝的新部落格的可用語言列表: 這個函式不需要任何引數,它將返回一個可用語言的陣列。

檢索網站/使用者註冊過程中的可用語言。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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() );
}
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() ); }
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
檢視更多 >