WPML

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

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

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

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

ปัญหานี้ได้รับการแก้ไขแล้วใน WPML 4.6.4 การอัปเดตจะแก้ปัญหานี้บนไซต์ของคุณ ดังนั้นคุณจึงต้องใช้วิธีแก้ปัญหาชั่วคราวนี้เฉพาะเมื่อคุณยังไม่สามารถอัปเดตได้

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

  1. เปิด …/sitepress-multilingual-cms/inc/taxonomy-term-translation/wpml-term-translation.class.php
  2. ค้นหาบรรทัดที่ 118
  3. เปลี่ยน:
    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'];
    		}
    	}
    }
    เป็น:
    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'] ] )
    				? 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']);
    		}
    	}
    }

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

ยังคงพบปัญหานี้อยู่หรือไม่

หากการอัปเดตไม่สามารถแก้ไขปัญหานี้ได้ ส่งคำถามถึงฝ่ายสนับสนุน และเราจะตรวจสอบร่วมกับคุณ