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?
- get_terms vs. get_categories: does it matter?
- Woocommerce get category image full size
- Fixing category count
- Can a Child Category Have More than One Parent?
- Combine two taxonomies in a hierarchical tree
- Elegant way to add parent categories?
- 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
- Update term count using a callback function
- How to Override default update_count_callback for category
- Getting the sub category
- Getting WordPress custom taxonomy/category?
- Return category slug / title from category ID
- How to get the number of child categories a specific parent category has?
- Get term by slug in Gutenberg
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- How to get the depth of a category’s subcategories
- 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?
- Best way to programmatically link to multiple categories (union/intersection) [closed]
- Want to hide some categories from the categories meta box in the post editor for the two specific user roles
- Get all sub-categories of a parent category
- Can I use get_adjacent_post for specific categories?
- Taxonomy filter all children
- How to get the id from the custom category?
- How to filter out Categories for specific post types on WordPress Admin?
- Filtering *out* a taxonomy from the admin post list
- category image taxonomy
- How to “group” (categorize) the Pages together?
- Custom taxonomy/category order
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Getting category URL with hyphens, not spaces
- Targeting Parent Category Pages
- Include WooCommerce product to all child categories
- Notice: Trying to get property of non-object in : custom fields category
- How to Link to Most Recent Custom Post of Same Term
- WP REST API not retrieving all categories
- How to display a value inside a post with a specified category from a category custom field? [closed]
- Eliminate word from $term->name
- What Must to Display the “mysite.com/category” URL?
- Getting Category Children
- Style a category from category list
- Showing HTML if Post is In Certain Taxonomy Term
- Get posts in a subcategory of a chosen parent
- How to get posts using category slug in ClassiPress?
- get_the_category – display only a single category for a post (not all categories)
- display category with background color
- Add properties to term object
- Disable Category Taxonomy
- List taxonomy terms assigned to a post in hierarchical view
- Sort categories by custom field in WordPress admin
- How to get immediate children of a ‘term’ parent id through ‘get_terms’?
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Post List by category and under custom taxonomy
- get taxonomy list in a page in the wordpress
- Number of categories slowing down the site
- Add subcategories posts to the counts column at the admin’s categories list
- How to echo Tags and Categories as plain text
- Categories and Tags Conflict after Woocommerce Installation
- Get category of a taxonomy for a queries object in a loop
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- List Terms by category
- How to add a new child category via an SQL statement?
- Taxonomy for custom post type not found
- Delete Term via edit-tags.php
- Use get variable when rewritten url in wordpress
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- Issue on Listing Sub Product Categories In Woocommerce
- Images as Categories
- Quick Edit on taxonomy names results in error
- Using same term for slug and category