WPML
상태
해결됨
보고된 제품
WPML Multilingual CMS 4.6.4
해결된 버전
WPML 4.7
관련 플러그인/테마
WooCommerce Memberships
주제 태그
Compatibility

문제 개요

WooCommerce Membership을 사용하는 경우, 멤버십 플랜 내의 콘텐츠 제한 설정에 페이지를 추가한 후 삭제하면 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;
    }

알려진 모든 문제 →