pll_get_post_translations

Returns an array of translations of a post.

Description

(array) pll_get_post_translations( (int) $post_id ); 

Returns (array)

an associative array of translations with language code as key and translation post_id as value

Parameters (1)

0. $post_id (int)
The post id.

Usage

  1. if ( !function_exists( 'pll_get_post_translations' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'polylang/include/api.php'; 
  3.  
  4. // The post id. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pll_get_post_translations($post_id); 
  9.  

Defined (1)

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

/include/api.php  
  1. function pll_get_post_translations( $post_id ) { 
  2. return PLL()->model->post->get_translations( $post_id );