Skip Navigation
availability:

WPML Version: 4.0.0

description:

Allows setting a translation mode for a given post type.

type:
action
category:
Updating Content
parameters:
do_action( 'wpml_set_translation_mode_for_post_type', $post_type, $translation_mode );
$post_type
(string) (Required) The slug of the post type you want to set translation mode for.
$translation_mode
(string) (Required) Translation mode to set, can be one of the following values:

  • “do_not_translate”
  • “translate”
  • “display_as_translated”
hook example usage:

Let’s say you have a custom post type “Books” (its slug is “book”) and you want to set it to use translation if available or fallback to default language.

do_action( 'wpml_set_translation_mode_for_post_type', "book", "display_as_translated" );