false, 'query_var' => false)); $ids = get_posts(array( 'post_type' => 'polylang_mo', 'numberposts' => -1, 'nopaging' => true, 'fields' => 'ids', )); foreach ($ids as $id) wp_delete_post($id, true); // need to register the taxonomies foreach (array('language', 'term_language', 'post_translations', 'term_translations') as $taxonomy) register_taxonomy($taxonomy, null , array('label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false)); // delete all what is related to languages and translations foreach (get_terms(array('term_language', 'post_translations', 'term_translations'), array('hide_empty'=>false)) as $term) { $term_ids[] = (int) $term->term_id; $tt_ids[] = (int) $term->term_taxonomy_id; } if (!empty($term_ids)) { $term_ids = array_unique($term_ids); $wpdb->query("DELETE FROM $wpdb->terms WHERE term_id IN (" . implode(',', $term_ids) . ")"); $wpdb->query("DELETE FROM $wpdb->term_taxonomy WHERE term_id IN (" . implode(',', $term_ids) . ")"); } if (!empty($tt_ids)) { $tt_ids = array_unique($tt_ids); $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . implode(',', $tt_ids) . ")"); } $languages = get_terms('language', array('hide_empty' => 0)); foreach($languages as $lang) { $description = maybe_unserialize($lang->description); if (is_array($description)) wp_update_term((int) $lang->term_id, 'language', array('description' => $description['locale'])); } $options = get_option('polylang'); $options['version'] = '1.1.6'; update_option('polylang', $options); }