Advertisement
Guest User

Untitled

a guest
Nov 26th, 2018
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.  
  3. global $wpdb;
  4.  
  5. $translation_ids_q = "SELECT translation_id FROM {$wpdb->prefix}icl_translations WHERE language_code = 'pl' AND element_type = 'post_product' ";
  6.  
  7. $translation_ids = $wpdb->get_results($translation_ids_q);
  8.  
  9. foreach ($translation_ids as $translation_id) {
  10.     $translation_status_q = "SELECT * FROM {$wpdb->prefix}icl_translation_status WHERE translation_id = {$translation_id->translation_id}";
  11.     $status_set = $wpdb->get_results($translation_status_q);
  12.  
  13.     if ( !$status_set ) {
  14.         $inserted = $wpdb->insert($wpdb->prefix . "icl_translation_status",
  15.             array ( 'translation_id' => $translation_id->translation_id,
  16.                     'status' => ICL_TM_COMPLETE,
  17.                     'needs_update' => 0)
  18.             );
  19.     }
  20.  
  21. }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement