- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPML Multilingual CMS 4.6.3
- Đã giải quyết trong
- WPML 4.6.4
- Thẻ chủ đề
- Bug
Tổng quan về lỗi
Khi tạo một menu và gán nó vào một vị trí trong Giao diện → Menu, việc tải lại trang sẽ bỏ chọn hộp kiểm vị trí. Tuy nhiên, menu vẫn hiển thị chính xác trên giao diện người dùng.
Sự cố này xảy ra khi các ID thuật ngữ không bằng các ID phân loại thuật ngữ, điều này có thể xảy ra trên các trang web chạy WordPress từ phiên bản 4.1 trở về trước như được giải thích tại đây.
Giải pháp tạm thời
Vui lòng đảm bảo tạo bản sao lưu đầy đủ cho trang web của bạn trước khi tiếp tục.
- Mở …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php.
- Tìm dòng 118.
- Thay đổi:
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']; } } }Thành: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']); } } }