function if_cloned_attachment($post_ID)
 {
     global $wpdb;
     if ($post = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE ID = %d", $post_ID))) {
         if ('attachment' == $post->post_type) {
             $attachment_post_language = get_cur_language($post_ID, 'slug');
             // test meta lang
             $linked_list = $this->translated_in($post_ID, 'array');
             if (array() != $linked_list) {
                 $this->dont_delete_file = true;
                 // update meta in linked attachments
                 // a:1:{s:5:"en_us";a:3:{s:7:"post_ID";s:4:"8537";s:4:"name";s:5:"en_US";s:11:"description";s:7:"english";}}
                 foreach ($linked_list as $lang_slug => $linked_array) {
                     delete_post_meta($linked_array['post_ID'], QUETAG . '-' . $attachment_post_language);
                     // 2.18.1
                 }
             } else {
                 $this->dont_delete_file = false;
             }
         }
     }
 }
 /**
  * return integer/array(id) of flags
  *
  * @since 2.15
  * params $lang (empty = full series), 'admin' to detect admin_custom_xili_flag
  *
  * @return id or array
  */
 function get_flag_series($lang = '', $admin = '')
 {
     $context = $admin == 'admin' ? 'admin_' : '';
     $transient_name = $context . 'get_flag_series';
     if (false === ($flag_series = get_transient($transient_name))) {
         // test if in cache 2.16.4
         $query = array('post_type' => 'attachment', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_wp_attachment_context', 'value' => $context . 'custom_xili_flag', 'compare' => '=')));
         $flags = get_posts($query);
         $flag_series = array();
         if ($flags) {
             $flags_ids = wp_list_pluck((array) $flags, 'ID');
             $flags_ids = array_map('absint', $flags_ids);
             foreach ($flags_ids as $flag_id) {
                 $attachment_post_language = get_cur_language($flag_id, 'slug');
                 if ('' != $attachment_post_language) {
                     $flag_series[$attachment_post_language] = $flag_id;
                 }
             }
         }
         set_transient($transient_name, $flag_series, 1000 * HOUR_IN_SECONDS);
     }
     if ($lang) {
         if (isset($flag_series[$lang])) {
             return $flag_series[$lang];
         } else {
             return 0;
         }
     } else {
         return $flag_series;
     }
 }