Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. $executionStartTime = microtime(true);
  2.  
  3. set_time_limit(0);
  4.  
  5. $orderby = 'parent';
  6. $order = 'asc';
  7. $hide_empty = false ;
  8. $cat_args = array(
  9.     'orderby'    => $orderby,
  10.     'order'      => $order,
  11.     'hide_empty' => $hide_empty,
  12. );
  13.  
  14. $product_categories = get_terms( 'product_cat', $cat_args );
  15.  
  16. /*
  17.     * PLL()->duplicate->duplicate_term( $tr_term, $term, $lang );
  18.     * $tr_term: always set it to false (or something empty).
  19.     * $term: The term_id of the term to duplicate
  20.     * $lang: The language code of the new term that you want ot create.
  21.     */
  22.  
  23. foreach ($product_categories as $category) {
  24.  
  25.         PLL()->duplicate->duplicate_term( false, $category->term_id, en ); 
  26.         PLL()->duplicate->duplicate_term( false, $category->term_id, de ); 
  27.         PLL()->duplicate->duplicate_term( false, $category->term_id, fr ); 
  28.    
  29.  
  30.  
  31.     /*
  32.     echo '<ul>';
  33.     echo '<li>';
  34.     echo '<a href="'.get_term_link($category).'" >';
  35.     echo $category->name;
  36.     echo '</a>';
  37.     echo '  parent id: ' . $category->parent;
  38.     echo '  term id: ' . $category->term_id;
  39.     echo '</li>';
  40.     echo '</ul>';
  41.     */
  42.  
  43. }
  44.  
  45. $executionEndTime = microtime(true);
  46.   $seconds = $executionEndTime - $executionStartTime;
  47.   echo 'Done! execution time ' . date("i:s:v",$seconds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement