WPML
สถานะ
แก้ไขแล้ว
รายงานสำหรับ
WPML Multilingual CMS 4.6.4
แก้ไขใน
WPML 4.7
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
WooCommerce Memberships
แท็กหัวข้อ
Compatibility

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

หากคุณกำลังใช้ WooCommerce Membership คุณจะสังเกตเห็นว่าหากมีการเพิ่มหน้าภายใต้การตั้งค่า Restrict Content ภายในแผนสมาชิกและถูกลบในภายหลัง WPML จะนำข้อจำกัดไปใช้กับทุกหน้าทั่วทั้งไซต์อย่างไม่ถูกต้อง ไม่ใช่เฉพาะหน้าที่ระบุไว้ในแผนสมาชิกเท่านั้น

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

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


  • เปิดไฟล์ …/wp-content/plugins/woocommerce-multilingual/compatibility/WcMemberships/class-wcml-wc-memberships.php

  • ค้นหาบรรทัดที่ 134

  • แทนที่โค้ดนี้:
    public function add_translated_object_ids( $object_ids ) {
    	$result = [];
    	foreach ( $object_ids as $object_id ) {
    		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
    		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
    		$translations = array_values( wp_list_pluck(
    			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
    			'element_id'
    		) );
    
    		$result = array_merge( $result, $translations );
    	}
    
    	return $result;
    }


  • ด้วย:
    public function add_translated_object_ids( $object_ids ) {
    	$result = [];
    	foreach ( $object_ids as $object_id ) {
    		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
    		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
    		$translations = array_values( wp_list_pluck(
    			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
    			'element_id'
    		) );
    
    		$result = array_merge( $result, $translations );
    	}
    
    	// Workaround for compsupp-6900
    	if ( empty($result) ) {
    		return $object_ids;
    	}
    
    	return $result;
    }

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