pll_register_string

Registers a string for translation in the "strings translation" panel.

Description

pll_register_string( (string) $name, (string) $string, (string) $context = 'polylang', (bool) $multiline = false ); 

Parameters (4)

0. $name (string)
A unique name for the string
1. $string (string)
The string to register
2. $context — Optional. (string) => 'polylang'
The group in which the string is registered, defaults to polylang
3. $multiline — Optional. (bool) => false
Wether the string table should display a multiline textarea or a single line input, defaults to single line

Usage

  1. if ( !function_exists( 'pll_register_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'polylang/include/api.php'; 
  3.  
  4. // a unique name for the string 
  5. $name = ''; 
  6.  
  7. // the string to register 
  8. $string = ''; 
  9.  
  10. // optional the group in which the string is registered, defaults to 'polylang' 
  11. $context = 'polylang'; 
  12.  
  13. // optional wether the string table should display a multiline textarea or a single line input, defaults to single line 
  14. $multiline = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = pll_register_string($name, $string, $context, $multiline); 
  18.  

Defined (1)

The function is defined in the following location(s).

/include/api.php  
  1. function pll_register_string( $name, $string, $context = polylang, $multiline = false ) { 
  2. if ( PLL() instanceof PLL_Admin_Base ) { 
  3. PLL_Admin_Strings::register_string( $name, $string, $context, $multiline );