PluginProbe
Polylang / 2.6.2
Polylang v2.6.2
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/translated-term.php +2 -7 2.92.6.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Setups the taxonomies languages and translations model
8 5 *
@@ -87,9 +84,9 @@
87 84 }
88 85
89 86 // get_term_by still not cached in WP 3.5.1 but internally, the function is always called by term_id
90 87 elseif ( is_string( $value ) && $taxonomy ) {
91 - $term_id = get_term_by( 'slug', $value, $taxonomy )->term_id;
88 + $term_id = wpcom_vip_get_term_by( 'slug', $value, $taxonomy )->term_id;
92 89 }
93 90
94 91 // Get the language and make sure it is a PLL_Language object
95 92 return isset( $term_id ) && ( $lang = $this->get_object_term( $term_id, 'term_language' ) ) ? $this->model->get_language( $lang->term_id ) : false;
@@ -130,9 +127,9 @@
130 127 wp_delete_object_term_relationships( $id, 'term_translations' );
131 128
132 129 if ( ! doing_action( 'pre_delete_term' ) && $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM $wpdb->terms WHERE term_id = %d;", $id ) ) ) {
133 130 // Always keep a group for terms to allow relationships remap when importing from a WXR file
134 - $translations = array( $slug => $id );
131 + $translations[ $slug ] = $id;
135 132 wp_insert_term( $group = uniqid( 'pll_' ), 'term_translations', array( 'description' => maybe_serialize( $translations ) ) );
136 133 wp_set_object_terms( $id, $group, 'term_translations' );
137 134 }
138 135 }
@@ -160,10 +157,8 @@
160 157 * @param array $taxonomies queried taxonomies
161 158 * @return array unmodified $terms
162 159 */
163 160 public function _prime_terms_cache( $terms, $taxonomies ) {
164 - $term_ids = array();
165 -
166 161 if ( is_array( $terms ) && $this->model->is_translated_taxonomy( $taxonomies ) ) {
167 162 foreach ( $terms as $term ) {
168 163 $term_ids[] = is_object( $term ) ? $term->term_id : (int) $term;
169 164 }