- Statut
- Résolu
- Signalé pour
- WPML Multilingual CMS 4.6.3
- Résolu dans
- WPML 4.6.4
- Étiquettes de sujet
- Bug
Aperçu de l’anomalie
Lors de la création d’un menu et de son attribution à un emplacement dans Apparence → Menus, l’actualisation de la page décoche la case de l’emplacement. Cependant, le menu s’affiche toujours correctement sur l’interface publique.
Ce problème se produit lorsque les ID de terme ne sont pas égaux aux ID de taxonomie de terme, ce qui peut arriver sur les sites utilisant WordPress depuis la version 4.1 ou une version antérieure, comme expliqué ici.
Solution de contournement
Assurez-vous de faire une sauvegarde complète de votre site avant de continuer.
- Ouvrez …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php.
- Cherchez la ligne 118.
- Remplacez :
private function maybe_warm_term_id_cache() { if ( ! isset( $this->ttids ) || ! isset( $this->term_ids ) ) { $data = $this->wpdb->get_results( " SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy " . $this->get_element_join() . " JOIN {$this->wpdb->terms} terms ON terms.term_id = tax.term_id WHERE tax.term_id != tax.term_taxonomy_id", ARRAY_A ); $this->term_ids = array(); $this->ttids = array(); foreach ( $data as $row ) { $this->ttids[ $row['term_id'] ] = isset( $this->ttids[ $row['term_id'] ] ) ? $this->ttids[ $row['term_id'] ] : array(); $this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = $row['element_id']; $this->term_ids[ $row['element_id'] ] = $row['term_id']; } } }Par :private function maybe_warm_term_id_cache() { if ( ! isset( $this->ttids ) || ! isset( $this->term_ids ) ) { $data = $this->wpdb->get_results( " SELECT wpml_translations.element_id, tax.term_id, tax.taxonomy " . $this->get_element_join() . " JOIN {$this->wpdb->terms} terms ON terms.term_id = tax.term_id WHERE tax.term_id != tax.term_taxonomy_id", ARRAY_A ); $this->term_ids = array(); $this->ttids = array(); foreach ( $data as $row ) { $this->ttids[ $row['term_id'] ] = isset( $this->ttids[ $row['term_id'] ] ) ? absint($this->ttids[ $row['term_id'] ]) : array(); $this->ttids[ $row['term_id'] ][ $row['taxonomy'] ] = absint($row['element_id']); $this->term_ids[ $row['element_id'] ] = absint($row['term_id']); } } }