pll_set_post_language

Set the post language.

Description

pll_set_post_language( (int) $id, (string) $lang ); 

Parameters (2)

0. $id (int)
The id.
1. $lang (string)
Language code

Usage

  1. if ( !function_exists( 'pll_set_post_language' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'polylang/include/api.php'; 
  3.  
  4. // The id. 
  5. $id = -1; 
  6.  
  7. // language code 
  8. $lang = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = pll_set_post_language($id, $lang); 
  12.  

Defined (1)

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

/include/api.php  
  1. function pll_set_post_language( $id, $lang ) { 
  2. PLL()->model->post->set_language( $id, $lang );