Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $executionStartTime = microtime(true);
- set_time_limit(0);
- $orderby = 'parent';
- $order = 'asc';
- $hide_empty = false ;
- $cat_args = array(
- 'orderby' => $orderby,
- 'order' => $order,
- 'hide_empty' => $hide_empty,
- );
- $product_categories = get_terms( 'product_cat', $cat_args );
- /*
- * PLL()->duplicate->duplicate_term( $tr_term, $term, $lang );
- * $tr_term: always set it to false (or something empty).
- * $term: The term_id of the term to duplicate
- * $lang: The language code of the new term that you want ot create.
- */
- foreach ($product_categories as $category) {
- PLL()->duplicate->duplicate_term( false, $category->term_id, en );
- PLL()->duplicate->duplicate_term( false, $category->term_id, de );
- PLL()->duplicate->duplicate_term( false, $category->term_id, fr );
- /*
- echo '<ul>';
- echo '<li>';
- echo '<a href="'.get_term_link($category).'" >';
- echo $category->name;
- echo '</a>';
- echo ' parent id: ' . $category->parent;
- echo ' term id: ' . $category->term_id;
- echo '</li>';
- echo '</ul>';
- */
- }
- $executionEndTime = microtime(true);
- $seconds = $executionEndTime - $executionStartTime;
- echo 'Done! execution time ' . date("i:s:v",$seconds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement