Aperçu de l’anomalie
Lors de la création d’un menu et de son attribution à un emplacement dans ApparenceMenus, 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 (s'ouvre dans un nouvel onglet).
Solution de contournement
Ce problème est résolu dans WPML 4.6.4. La mise à jour résout le problème sur votre site, vous n’avez donc besoin de cette solution de contournement que si vous ne pouvez pas encore mettre à jour.
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 :
Par :PHP
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']; } } }
PHPprivate 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']); } } }