/** * Deletes a translation * * @since 0.5 * * @param int $id term id */ public function delete_translation($id) { global $wpdb; $slug = array_search($id, $this->get_translations($id)); // in case some plugin stores the same value with different key parent::delete_translation($id); if ($wpdb->get_var($wpdb->prepare("SELECT COUNT( * ) FROM {$wpdb->terms} WHERE term_id = %d;", $id))) { // always keep a group for terms to allow relationships remap when importing from a WXR file $translations[$slug] = $id; wp_insert_term($group = uniqid('pll_'), 'term_translations', array('description' => serialize($translations))); wp_set_object_terms($id, $group, 'term_translations'); } }
/** * Deletes a translation * * @since 0.5 * * @param int $id post id */ public function delete_translation($id) { parent::delete_translation($id); wp_set_object_terms($id, null, $this->tax_translations); }