WPML
상태
개발자가 해결함
보고된 제품
WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
관련 플러그인/테마
BuddyBoss Platform
주제 태그
Compatibility

문제 개요

BuddyBoss 프로필 페이지에서 번역된 택소노미 필드의 알파벳순 정렬이 일관되지 않습니다. 기본 언어 필드는 올바르게 정렬되지만, 번역된 필드는 이 순서를 유지하지 않습니다.

임시 해결 방법

진행하기 전에 전체 사이트 백업을 완료했는지 확인하세요.


  • …/wp-content/plugins/buddyboss-platform/bp-xprofile/classes/class-bp-xprofile-field-type-selectbox.php 파일을 여세요.

  • BP_XProfile_Field_Type_Selectbox::edit_field_options_html() 내부의 다음 줄을:
    echo $html;

  • 다음과 같이 교체하세요:
    // WPML Workaround for compsupp-7514
    if ( class_exists('Sitepress') && apply_filters('wpml_default_language', NULL ) != apply_filters( 'wpml_current_language', NULL ) ) {
    	// Match all options
    	preg_match_all('/<option(.*?)>(.*?)<\/option>/s', $html, $matches, PREG_SET_ORDER);
    
    	// Extract the options into an array
    	$optionsArray = [];
    	foreach ($matches as $match) {
    		$optionsArray[] = [
    			'full' => $match[0],
    			'attributes' => $match[1],
    			'text' => $match[2],
    		];
    	}
    
    	// Sort the array by the 'text' element
    	usort($optionsArray, function($a, $b) {
    		return strcmp($a['text'], $b['text']);
    	});
    
    	// Rebuild the HTML string
    	$sortedHtml = '';
    	foreach ($optionsArray as $option) {
    		$sortedHtml .= sprintf('<option%s>%s</option>', $option['attributes'], $option['text']);
    	}
    
    	$html = $sortedHtml;
    }
    
    echo $html;

알려진 모든 문제 →