Using polylang, how can I see which post is the “original” and which are the “translated children”? [closed]

I am using Polylang. It is not obvious to me how the relationship between posts are established. I can switch between different language versions of the same post, and I can tell that they’re (obviously) different posts in the database.
But I can see how Polylang establishes and maintains that relationship. I assumed that there was some meta-value, but that’s not the case.
Does anyone have any insight?

Initially, I’d like to know this, because I need to create a publish flow where translations aren’t accidentally published before the “original”.

2 Answers
2

polylang stores translation in a taxinomy but it’s better to access them with the polylang object like that :

// test if the plugin polylang is present
if (isset($GLOBALS["polylang"])) {

    $translations = $GLOBALS["polylang"]->model->post->get_translations($post->ID);

    // $translations contains an array with all translations of the post

}

all translations are interconnected then there is no parent translation. if you want to find the first created post you can search the lowest ID or sort by publication time.

Leave a Comment