add_action( 'wpml_tm_loaded', callable $function_to_add );
- 类型
- action
- 类别
- 杂项
- WPML 版本
- 3.2.1
说明
- 为了确保依赖于 WPML 翻译管理的代码在正确的时间执行,应将此代码挂载到
wpml_tm_loaded操作。该操作在 WPML 翻译管理完全配置并加载后调用。 - 如果我们不将其挂载到此
wpml_tm_loaded,有时依赖于 WPML 翻译管理的代码可能会被过早调用。那么,即使 WPML 翻译管理已激活并配置,我们也可能无法获得预期的结果。 wpml_tm_loaded在 plugins_loaded 和 wpml_loaded 操作期间执行。- WPML 翻译管理有一个类似的钩子 wpml_st_loaded。
参数
- $function_to_add
- (callable) (必填) 应用过滤器时要运行的回调函数。
使用示例
示例
function my_plugin_wpml_tm_code() {
// Run WPML Translation Management dependent actions
// These actions will be executed right after WPML Translation Management is fully configured and loaded.
}
add_action( 'wpml_tm_loaded', 'my_plugin_wpml_tm_code' );
相关钩子
icl_ls_languages, wpml_sync_custom_field_copied_value, wpml_ls_enable_ajax_navigation, wpml_element_type, wpml_setting, wpml_sub_setting, wpml_exclude_post_from_auto_translate, wpml_forms_config_ninja-forms, wpml_forms_config_wpforms, wpml_tf_feedback_open_link