- 状态
- 已解决
- 报告针对
- WPML Multilingual CMS 4.6.3
- 解决于
- WPML 4.6.4
- 主题标签
- Bug
问题概述
在外观 → 菜单中创建菜单并将其分配给一个位置时,刷新页面后位置复选框会被取消选中。但是,菜单在前端仍然正确显示。
当术语 ID 不等于术语分类法 ID 时会出现此问题,如此处所述,这种情况可能发生在运行 WordPress 4.1 或更早版本的站点上。
临时解决方法
在继续操作之前,请务必对您的站点进行完整备份。
- 打开 …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php。
- 找到第 118 行。
- 将:
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']; } } }更改为: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']); } } }