do_action( 'wpml_set_translation_mode_for_post_type', $post_type, $translation_mode );
- 类型
- action
- 类别
- 更新内容
- WPML 版本
- 4.0.0
说明
允许为指定的文章类型设置翻译模式。
参数
- $post_type
- (字符串) (必填) 您要为其设置翻译模式的文章类型别名。
- $translation_mode
- (字符串) (必填) 要设置的翻译模式,可以是以下值之一:
- “do_not_translate”
- “translate”
- “display_as_translated”
使用示例
假设您有一个自定义文章类型“Books”(其别名为“book”),并且您希望将其设置为在有可用翻译时使用翻译,否则回退到默认语言。
do_action( 'wpml_set_translation_mode_for_post_type', "book", "display_as_translated" );
相关钩子
wpml_apply_save_attachment_actions, wpml_st_force_translate_admin_options