Quantcast
Viewing all articles
Browse latest Browse all 11471

Chouby on "[Plugin: Polylang] Create posts translations on existing site with large number of records (700)"

Hi!

Thanks a lot for your participation to other topics. I appreciate a lot. As you can see, I am not as reactive as I used to be in the past as the number of requests increases logically with the number of users...

For your problem, I would make things with PHP in a plugin. I would first create a post with wp_insert_post. This function will return the post_id of the just created post.
You can set the language of the post with:

global $polylang;
$polylang->model->set_post_language($post_id, 'en');

and then set translation with:

$polylang->model->save_translations('post', $post_id, array('fr' => $fr_post_id));

where $fr_post_id is of the post id of your initial french post.


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>