Plugin Author
Chouby
(@chouby)
Hi!
If you want to assign the language of several categories at once, you can use the bulk edit. There is however no way to assign the translations of several categories at once as there is no way to know which category is the translation of each one.
If you were looking for PHP “function”, you can use pll_set_term_language() and pll_save_term_translations(): see
https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/#pll_set_term_language
Sorry was late to check your reply. Will try to use them. Thanks
I have an array of posts with id and preferred languages (‘en’ or ‘el’) to be set to.
So, I have made a simple function to run like the following.
global $polylang;
if ($posts) {
foreach ($posts as $post) {
$post_id = $post['nid'];
$lang = $post['language'];
if ( TRUE === get_post_status( $post_id ) ) {
$polylang->model->set_post_language($post_id, $lang);
}
}
}
But, how I will run this function? I want to run in only once, as there plenty of posts imported that have not any language set.
Thank you!
Regards,
Andreas
@pandreas: If you require assistance then, as per the Forum Welcome, please post your own topic.