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.
  1. $translation = apply_filters( 'pll_sanitize_string_translation', $translation, $this_strings_key_name, $this_strings_key_context ); 
  2.  
  3. if ( !empty( $translation ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pll_sanitize_string_translation callback 
  2. function filter_pll_sanitize_string_translation( $translation, $this_strings_key_name, $this_strings_key_context ) { 
  3. // make filter magic happen here... 
  4. return $translation
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pll_sanitize_string_translation', 'filter_pll_sanitize_string_translation', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. 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  
  1. $translation = apply_filters( 'pll_sanitize_string_translation', $translation, $this->strings[ $key ]['name'], $this->strings[ $key ]['context'] );