- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPML Multilingual CMS 4.6.4
- Đã giải quyết trong
- WPML 4.7
- Plugin/giao diện liên quan
- WooCommerce Memberships
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Nếu bạn đang sử dụng WooCommerce Membership, bạn sẽ nhận thấy rằng nếu một trang được thêm vào phần cài đặt Restrict Content trong một gói thành viên và sau đó bị xóa, WPML sẽ áp dụng sai hạn chế này cho tất cả các trang trên toàn trang web, chứ không chỉ những trang được chỉ định trong gói thành viên.
Giải pháp tạm thời
Vui lòng đảm bảo sao lưu toàn bộ trang web của bạn trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/woocommerce-multilingual/compatibility/WcMemberships/class-wcml-wc-memberships.php.
- Tìm dòng 134.
- Thay thế mã này:
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; } - Bằng:
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; }