Search code examples
wordpresspolylang

Wordpress - Polylang: get list of page translations


I'm using Polylang to manage languages on my Wordpress implementation. My default language is French and when I'm on translated pages, I'd like to find the page ID from the original page in French.

I have looking in the documentation but it doesn't look like there is a possibility to retrieve the post ID of the default language (or any other language than the current page).

Do you know any possibility to do this?

Thanks Laurent


Solution

  • I have found the solution and here is the code:

    $original_page_id= pll_get_post($current_page_id, $default_language);
    

    this code will return the page ID from the chosen language ($default_language)