WPML
สถานะ
แก้ไขแล้ว
แก้ไขใน
4.5.0
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Houzez

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

ธีม Houzez ใช้ฟังก์ชันแบบกำหนดเองของตัวเองเพื่อเรียกใช้ตัวเลือกธีม หากภาษาเริ่มต้นของเว็บไซต์ของคุณไม่ใช่ภาษาอังกฤษ ฟังก์ชันนี้จะขัดแย้งกับ WPML ส่งผลให้การแปลจะไม่แสดงในส่วนหน้าเว็บไซต์ และจะถูกเปลี่ยนกลับเป็นภาษาเริ่มต้นในหน้าจัดการเว็บไซต์

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

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


  1. เปิด /wpml-string-translation/inc/admin-texts/wpml-admin-texts.class.php

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

  3. แทนที่:
    	function icl_st_set_admin_options_filters() {
    		$option_names = $this->getOptionNames();
    
    		foreach ( $option_names as $option_key => $option ) {
    			if ( $this->is_blacklisted( $option_key ) ) {
    				unset( $option_names[ $option_key ] );
    				update_option( '_icl_admin_option_names', $option_names );
    			} elseif ( $option_key != 'theme' && $option_key != 'plugin' ) { // theme and plugin are an obsolete format before 3.2
    				add_filter( 'option_' . $option_key, array( $this, 'icl_st_translate_admin_string' ) );
    				add_action( 'update_option_' . $option_key, array( $this, 'on_update_original_value' ), 10, 3 );
    			}
    		}
    	}


  4. ด้วย:
    	function icl_st_set_admin_options_filters() {
    		$option_names = $this->getOptionNames();
    
    		$isAdmin = is_admin() && ! wpml_is_ajax();
    
    		foreach ( $option_names as $option_key => $option ) {
    			if ( $this->is_blacklisted( $option_key ) ) {
    				unset( $option_names[ $option_key ] );
    				update_option( '_icl_admin_option_names', $option_names );
    			} elseif ( $option_key != 'theme' && $option_key != 'plugin' ) { // theme and plugin are an obsolete format before 3.2
    				/**
    				 * We don't want to translate admin strings in admin panel because it causes a lot of confusion
    				 * when a value is displayed inside the form input.
    				 **/
    				if ( ! $isAdmin ) {
    					add_filter( 'option_' . $option_key, array( $this, 'icl_st_translate_admin_string' ) );
    				}
    				add_action( 'update_option_' . $option_key, array( $this, 'on_update_original_value' ), 10, 3 );
    			}
    		}
    	}

ขั้นตอนถัดไป

ปัญหานี้จะได้รับการแก้ไขเมื่อมีเวอร์ชันที่เผยแพร่ของ WPML 4.5 (ปลายเดือนกันยายน 2021)

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