| @@ -162,16 +162,15 @@ | ||
| 162 | 162 | $term = $this->get_object_term( $id, $this->tax_translations ); |
| 163 | 163 | |
| 164 | 164 | if ( ! empty( $term ) ) { |
| 165 | 165 | $d = maybe_unserialize( $term->description ); |
| 166 | - if ( is_array( $d ) ) { | |
| 167 | - $slug = array_search( $id, $this->get_translations( $id ) ); // In case some plugin stores the same value with different key. | |
| 168 | - unset( $d[ $slug ] ); | |
| 169 | - } | |
| 166 | + $slug = array_search( $id, $this->get_translations( $id ) ); // in case some plugin stores the same value with different key | |
| 167 | + unset( $d[ $slug ] ); | |
| 170 | 168 | |
| 171 | 169 | if ( empty( $d ) ) { |
| 172 | 170 | wp_delete_term( (int) $term->term_id, $this->tax_translations ); |
| 173 | - } else { | |
| 171 | + } | |
| 172 | + else { | |
| 174 | 173 | wp_update_term( (int) $term->term_id, $this->tax_translations, array( 'description' => maybe_serialize( $d ) ) ); |
| 175 | 174 | } |
| 176 | 175 | } |
| 177 | 176 | } |
| @@ -279,25 +278,9 @@ | ||
| 279 | 278 | */ |
| 280 | 279 | public function get_objects_in_language( $lang ) { |
| 281 | 280 | global $wpdb; |
| 282 | 281 | $tt_id = $this->tax_tt; |
| 283 | - | |
| 284 | - $last_changed = wp_cache_get_last_changed( 'terms' ); | |
| 285 | - $cache_key = "polylang:get_objects_in_language:{$lang->$tt_id}:{$last_changed}"; | |
| 286 | - $cache = wp_cache_get( $cache_key, 'terms' ); | |
| 287 | - | |
| 288 | - if ( false === $cache ) { | |
| 289 | - $object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $lang->$tt_id ) ); | |
| 290 | - wp_cache_set( $cache_key, $object_ids, 'terms' ); | |
| 291 | - } else { | |
| 292 | - $object_ids = (array) $cache; | |
| 293 | - } | |
| 294 | - | |
| 295 | - if ( ! $object_ids ) { | |
| 296 | - return array(); | |
| 297 | - } | |
| 298 | - | |
| 299 | - return $object_ids; | |
| 282 | + return $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $lang->$tt_id ) ); | |
| 300 | 283 | } |
| 301 | 284 | |
| 302 | 285 | /** |
| 303 | 286 | * Check if a user can synchronize translations |