- availability:
-
WPML Version: 3.2
- description:
-
*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_stringNote: This hook requires the WPML String Translation module
- type:
- filter
- category:
- Retrieving Localized Content
- parameters:
-
apply_filters( 'wpml_translate_string', string $string_value, string $string_name, (integer|array|object) $package )
- $string_value
- (string) (Required) The string’s original value
- $string_name
- (string) (Required) The string’s registered name
- $package
- (mixed) (Required) The string’s registered package identifier
-
- If $package is an array it needs to be associative and contain keys
kind
andname
. - If $package is an object it needs to have
kind
andname
fields.
- If $package is an array it needs to be associative and contain keys
- hook example usage:
-
A complete and detailed example can be found on the “String Package Translation” documentation page.