You can actually make it this way:
$cat1 = wp_insert_term(
'Cat1',
'category',
['slug' => 'slug-cat1'],
);
$agenda = wp_insert_term(
'Agenda',
'category',
[
'slug' => 'slug-agenda',
'parent'=> term_exists( 'Cat1', 'category' )['term_id'],
],
);
pll_set_term_language($cat1['term_id'], 'fr');
pll_set_term_language($agenda['term_id'], 'de');
Here is link to Polylang Function reference:
https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/
Related Posts:
- Is There a Difference Between Taxonomies and Categories?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- Control term order on a per-post basis
- How can I select a primary category?
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Display empty taxonomy terms with get_terms()
- List Terms in Category
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Display Posts Loop for each parent and for each Child
- Is There a Difference Between Taxonomies and Categories?
- Get posts under a category with SQL
- get_terms function not returning anything
- Display custom taxonomy attached to the post on post single page
- Display sibling categories on category page
- Combining these queries? (Same taxonomy term + same category as post)
- Get WooCommerce product category list in functions.php
- outputting taxonomy hierarchy
- Display List of Categories Within a Custom Taxonomy
- get_adjacent_post_link excluded_terms ignored
- Why is my post categories not displaying?
- Problem importing categories and sub-categories
- Taxonomy term RestApi data 10 rows limitions
- hide_empty property not working when using get_terms
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Combine two taxonomies in a hierarchical tree
- get_terms name__like list categories according to letter
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Excluding posts from a category but only if they’re not in multiple categories
- How to Override default update_count_callback for category
- Getting the sub category
- How to get the number of child categories a specific parent category has?
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- Category page only displaying the posts from a custom type
- How can I convert some categories to a custom taxonomy?
- Any way to assign Post Categories and Tags to Links?
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- How to export/import categories and keep their IDs?
- How to use wp_category_checklist()?
- Get all sub-categories of a parent category
- Can I use get_adjacent_post for specific categories?
- Limit number of terms that a custom taxonomy can save per custom post type
- Change existing taxonomy settings when using custom taxonomy
- Display Taxonomy Terms in an option tag with value being the slug
- How to get the id from the custom category?
- category filter doesn’t work in WPML
- Filtering *out* a taxonomy from the admin post list
- category image taxonomy
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- How can I improve this taxonomy treating approach?
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- How to display parents category and child category separately for a specific post?
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- Get a count of how many times a term or a category is used in posts
- Get Categories Where Taxonomy Equals ‘n’
- How to display a value inside a post with a specified category from a category custom field? [closed]
- Echo text using is_tag
- Grandchild Term Things Grandfather Term is It’s Parent
- set terms to category and subcategory
- Get posts of a custom post type from category from taxonomy?
- Same menu for different taxonomies to reach different content
- Change categories count to include media attachments
- How to get selected taxonomy or category ID if using custom walker?
- Let user select their own category
- How could I write a get_categories_by_year() function?
- Get posts in a subcategory of a chosen parent
- Natural sort / ordering wp_dropdown_categories
- Best way to categorize/populate a magazine style layout
- Displaying posts of given category
- Automatically adding tags and categories into Post Excerpt for searching
- How can i add service category here? [duplicate]
- Show subChild categories
- List taxonomy terms assigned to a post in hierarchical view
- WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests
- How to set the same base url for two different taxonomies?
- Ordering terms whilst in loop
- Limit categories to hierarchal depth of 2
- get taxonomies from terms
- Show the parent taxonomy by creating shortcode in woocommerce?
- WordPress Portofolio Conditional Templating – functions php
- Parent Category and Subcategory default text generated with category
- Post List by category and under custom taxonomy
- List non-empty categories from a custom post type
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- Categories and Tags Conflict after Woocommerce Installation
- get_terms sort order with child categories of varying depth
- How to Manage and link certain custom taxonomy?
- Getting Post Tags From Certain Categories
- Display Taxonomies in loop with template args
- How to add a post with new Taxonomy without assigning to default category?
- Display only the latest post
- Delete Term via edit-tags.php
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- list taxonomy based on taxonomy
- Multiple Parent Category URLs
- Show parent-child relationship for categories in the wordpress admin
- Order Categories by Character Count
- List the category tree of all the product_cat categories