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;
    }

כל התקלות הידועות