add_action( 'wpml_st_loaded', callable $function_to_add );
- 类型
- action
- 类别
- 杂项
- WPML 版本
- 3.2.1
说明
- 为了确保依赖于 WPML 字符串翻译的代码在正确的时间执行,该代码应该挂载到
wpml_st_loaded操作上。此操作在 WPML 字符串翻译完全配置并加载后调用。 - 如果我们不挂载到此
wpml_st_loaded,有时依赖于 WPML 字符串翻译的代码可能会被过早调用。这样,即使 WPML 字符串翻译已激活并配置,我们也可能无法获得预期的结果。 wpml_st_loaded在 plugins_loaded 和 wpml_loaded 操作期间执行。- WPML 翻译管理也有一个类似的钩子 wpml_tm_loaded。
参数
- $function_to_add
- (callable) (必填) 应用过滤器时要运行的回调函数。
使用示例
示例
function my_plugin_wpml_st_code() {
// Run WPML String Translation dependent actions
// These actions will be executed right after WPML String Translation is fully configured and loaded.
}
add_action( 'wpml_st_loaded', 'my_plugin_wpml_st_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