WPML
wpml_update_active_languages
类型
action
WPML 版本
4.5.0

说明

在添加或删除新语言时运行您的自定义函数。

参数

add_action( 'wpml_update_active_languages', callable $function_to_add );
$function_to_add
(callable) (必填) 要在此操作上运行的回调函数。

使用示例

示例
/**
 * Run this function when active languages are updated.
 * 
 * @param array $old_active_languages An array of the languages before updating.
 * @return void 
 */
function wpml_update_active_languages_callback( $old_active_languages ) {
	// To get latest languages after updating use this hook https://wpml.org/wpml-hook/wpml_active_languages/ 
}
add_action('wpml_update_active_languages', 'wpml_update_active_languages_callback');

wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages

所有 29 个 全站语言信息 钩子 →