Skip Navigation

WPML Version: 3.2


*Retrieves a string translation. The filter looks up a string that is part of a package or a group of strings (as opposed to an individual string**). If it finds it, it looks for a translation in the current language. If a translation exists, it will return it. Otherwise, it will return the original string.

*To register a “package” string translation please see: wpml_register_string
**For retrieving an individual text string that does not belong to a package please see: wpml_translate_single_string

Note: This hook requires the WPML String Translation module

Retrieving Localized Content
apply_filters( 'wpml_translate_string', string $string_value, string $string_name, (integer|array|object) $package )
(string) (Required) The string’s original value
(string) (Required) The string’s registered name
(mixed) (Required) The string’s registered package identifier
  • If $package is an array it needs to be associative and contain keys kind and name.
  • If $package is an object it needs to have kind and name fields.
hook example usage:

A complete and detailed example can be found on the “String Package Translation” documentation page.