| @@ -84,9 +84,9 @@ | ||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // get_term_by still not cached in WP 3.5.1 but internally, the function is always called by term_id |
| 87 | 87 | elseif ( is_string( $value ) && $taxonomy ) { |
| 88 | - $term_id = get_term_by( 'slug', $value, $taxonomy )->term_id; | |
| 88 | + $term_id = wpcom_vip_get_term_by( 'slug', $value, $taxonomy )->term_id; | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Get the language and make sure it is a PLL_Language object |
| 92 | 92 | return isset( $term_id ) && ( $lang = $this->get_object_term( $term_id, 'term_language' ) ) ? $this->model->get_language( $lang->term_id ) : false; |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | wp_delete_object_term_relationships( $id, 'term_translations' ); |
| 128 | 128 | |
| 129 | 129 | if ( ! doing_action( 'pre_delete_term' ) && $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM $wpdb->terms WHERE term_id = %d;", $id ) ) ) { |
| 130 | 130 | // Always keep a group for terms to allow relationships remap when importing from a WXR file |
| 131 | - $translations = array( $slug => $id ); | |
| 131 | + $translations[ $slug ] = $id; | |
| 132 | 132 | wp_insert_term( $group = uniqid( 'pll_' ), 'term_translations', array( 'description' => maybe_serialize( $translations ) ) ); |
| 133 | 133 | wp_set_object_terms( $id, $group, 'term_translations' ); |
| 134 | 134 | } |
| 135 | 135 | } |
| @@ -157,10 +157,8 @@ | ||
| 157 | 157 | * @param array $taxonomies queried taxonomies |
| 158 | 158 | * @return array unmodified $terms |
| 159 | 159 | */ |
| 160 | 160 | public function _prime_terms_cache( $terms, $taxonomies ) { |
| 161 | - $term_ids = array(); | |
| 162 | - | |
| 163 | 161 | if ( is_array( $terms ) && $this->model->is_translated_taxonomy( $taxonomies ) ) { |
| 164 | 162 | foreach ( $terms as $term ) { |
| 165 | 163 | $term_ids[] = is_object( $term ) ? $term->term_id : (int) $term; |
| 166 | 164 | } |