탐색 건너뛰기

Open

Topic Tags: Compatibility

Overview of the issue

Users of the Filter Everything plugin combined with Advanced Custom Fields may encounter issues where ACF field values used in filters are not translated on the frontend. This problem occurs despite the fields being translated within the WPML String Translation.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Add the following code to the theme’s functions.php file:
    // WPML Workaround for compsupp-7581
    add_filter('wpc_terms_before_display', 'wpml_compsupp7581_filter_wpc_filter_terms', 10, 4 ); 
    
    function wpml_compsupp7581_filter_wpc_filter_terms($terms, $filter, $set, $urlManager) {
    	
    	if ( class_exists('Sitepress') ) {
    		foreach ($terms as &$term ) {
    			$label = $term->name;
    			$textdomain = 'WordPress';
    			$string_name = 'WPC Filter Label: '.substr($label, 0, 40);
    
    			if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
    				do_action( 'wpml_register_single_string', $textdomain, $string_name, $label );
    			}	
    			// Apply the translation to the string
    			$term->name = apply_filters('wpml_translate_single_string', $label , $textdomain, $string_name);
    
    		}
    	}
    	return $terms;
    }
    
  • Visit the page with the issue in the original language. This action will register the string.
  • Go to WPML > String Translation page and translate the string. It should be under WordPress textdomain.

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>