PluginProbe
Polylang / 3.6.7
Polylang v3.6.7
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 | modules/sync/sync.php +4 -4 3.0.33.6.7 View file →
@@ -40,9 +40,9 @@
40 40 * Constructor
41 41 *
42 42 * @since 1.2
43 43 *
44 - * @param object $polylang
44 + * @param object $polylang The Polylang object.
45 45 */
46 46 public function __construct( &$polylang ) {
47 47 $this->model = &$polylang->model;
48 48 $this->options = &$polylang->options;
@@ -167,9 +167,9 @@
167 167
168 168 $tr_arr = $postarr;
169 169 unset( $tr_arr['post_parent'] );
170 170
171 - // Do not udpate the translation parent if the user set a parent with no translation.
171 + // Do not update the translation parent if the user set a parent with no translation.
172 172 if ( isset( $postarr['post_parent'] ) ) {
173 173 $post_parent = $postarr['post_parent'] ? $this->model->post->get_translation( $postarr['post_parent'], $lang ) : 0;
174 174 if ( ! ( $postarr['post_parent'] && ! $post_parent ) ) {
175 175 $tr_arr['post_parent'] = $post_parent;
@@ -207,13 +207,13 @@
207 207 if ( $term instanceof WP_Term ) {
208 208 $translations = $this->model->term->get_translations( $term_id );
209 209
210 210 foreach ( $translations as $lang => $tr_id ) {
211 - if ( ! empty( $tr_id ) && $tr_id !== $term_id ) {
211 + if ( $tr_id !== $term_id ) {
212 212 $tr_parent = $this->model->term->get_translation( $term->parent, $lang );
213 213 $tr_term = get_term( (int) $tr_id, $taxonomy );
214 214
215 - if ( $tr_term instanceof WP_Term ) {
215 + if ( $tr_term instanceof WP_Term && ! ( $term->parent && empty( $tr_parent ) ) ) {
216 216 $wpdb->update(
217 217 $wpdb->term_taxonomy,
218 218 array( 'parent' => $tr_parent ? $tr_parent : 0 ),
219 219 array( 'term_taxonomy_id' => $tr_term->term_taxonomy_id )