How can i insert term in a specific language of Polylang?

Question

I have created a plug-in which permits to create a category with slugs.

There is the code :

wp_insert_term(
    'Cat1',
    'category',
    array(
    'slug' => 'slug-cat1',
));

wp_insert_term(
'Agenda',
'category',
array(
'slug' => 'slug-agenda',
'parent'=> term_exists( 'Cat1', 'category' )['term_id']

));

It permits to create my category in the default language of the website. So my question is, do you know how can i create a category as before, but i want to create it in another language than the default. I’m using Polylang to translate my website.

Have a good day.

0
Tweak 3 months 0 Answers 15 views 0

Leave an answer