WPML
สถานะ
แก้ไขแล้ว
รายงานสำหรับ
WPML Multilingual CMS 4.6.3
แก้ไขใน
WPML 4.6.4
แท็กหัวข้อ
Bug

ภาพรวมของปัญหา

เมื่อสร้างเมนูและกำหนดตำแหน่งใน รูปแบบเว็บเมนู การรีเฟรชหน้าเว็บจะทำให้ช่องทำเครื่องหมายตำแหน่งถูกยกเลิกการเลือก อย่างไรก็ตาม เมนูยังคงแสดงผลอย่างถูกต้องในส่วนหน้าเว็บไซต์

ปัญหานี้เกิดขึ้นเมื่อ ID ของ term ไม่เท่ากับ ID อนุกรมวิธานของ term ซึ่งอาจเกิดขึ้นได้บนไซต์ที่ใช้งาน WordPress ตั้งแต่เวอร์ชัน 4.1 หรือเก่ากว่า ดังที่อธิบายไว้ที่นี่

วิธีแก้ปัญหาชั่วคราว

โปรดสำรองข้อมูลไซต์ของคุณแบบเต็มรูปแบบก่อนดำเนินการต่อ


  1. เปิด …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php

  2. ค้นหาบรรทัดที่ 118

  3. เปลี่ยน:
    	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']);
    			}
    		}
    	}

ปัญหาที่ทราบแล้วทั้งหมด →