- 상태
- 해결됨
- 보고된 제품
- WPML Multilingual CMS 4.6.13
- 해결된 버전
- WPML Multilingual CMS 4.7.4
- 관련 플러그인/테마
- Elementor
- 주제 태그
- Compatibility
문제 개요
위젯 표시 여부를 제어하기 위해 Elementor Pro의 표시 조건 기능을 사용할 때 번역된 페이지에서 조건이 올바르게 적용되지 않습니다. 구체적으로, 번역된 언어의 태그 또는 카테고리가 예상대로 표시 조건을 트리거하지 않아 숨겨져야 할 요소가 계속 표시됩니다.
임시 해결 방법
진행하기 전에 사이트의 전체 사이트 백업을 완료했는지 확인하세요.
- 테마의 functions.php 파일을 여세요.
- 다음 스니펫을 추가하세요:
/* * WPML Workaround for compsupp-7656 */ add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7656_filter_e_display_conditions_from_widget'); function wpml_compsupp7656_filter_e_display_conditions_from_widget($element) { $settings = $element->get_settings(); if (array_key_exists('e_display_conditions', $settings) && !empty($settings['e_display_conditions'])) { foreach ($settings['e_display_conditions'] as $key => $condition_json) { $condition = json_decode($condition_json, true); foreach ($condition as &$condition_group) { foreach ($condition_group as &$single_condition) { if (isset($single_condition['condition']) && strpos($single_condition['condition'], 'in_') === 0) { $taxonomy_key = substr($single_condition['condition'], 3); // Remove 'in_' prefix if (isset($single_condition[$taxonomy_key])) { foreach ($single_condition[$taxonomy_key] as &$term) { if (isset($term['id'])) { $term_obj = get_term($term['id']); if ($term_obj && !is_wp_error($term_obj)) { $term['id'] = apply_filters('wpml_object_id', $term['id'], $term_obj->taxonomy, true); } } } } } } } // Encode the modified condition back to JSON $settings['e_display_conditions'][$key] = json_encode($condition); } // Update the element's settings with the modified conditions $element->set_settings('e_display_conditions', $settings['e_display_conditions']); } }