pll_sanitize_string_translation
Filter the string translation before it is saved in DB Allows to sanitize strings registered with pll_register_string.
Description
apply_filters( 'pll_sanitize_string_translation', (string) $translation, (string) $this_strings_key_name, (string) $this_strings_key_context );
Parameters (3)
- 0. $translation (string)
- The string translation
- 1. $this_strings_key_name (string)
- The name as defined in pll_register_string
- 2. $this_strings_key_context (string)
- The context as defined in pll_register_string
Usage
- To run the hook, copy the example below.
- $translation = apply_filters( 'pll_sanitize_string_translation', $translation, $this_strings_key_name, $this_strings_key_context );
- if ( !empty( $translation ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the pll_sanitize_string_translation callback
- function filter_pll_sanitize_string_translation( $translation, $this_strings_key_name, $this_strings_key_context ) {
- // make filter magic happen here...
- return $translation;
- };
- // add the filter
- add_filter( 'pll_sanitize_string_translation', 'filter_pll_sanitize_string_translation', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'pll_sanitize_string_translation', 'filter_pll_sanitize_string_translation', 10, 3 );
Defined (1)
The filter is defined in the following location(s).
- /settings/table-string.php
- $translation = apply_filters( 'pll_sanitize_string_translation', $translation, $this->strings[ $key ]['name'], $this->strings[ $key ]['context'] );