WPML

문제 개요

WP User Manager를 사용하여 프로필에 사용자 정의 필드를 추가할 때 다음과 같은 문제가 발생할 수 있습니다: 사용자 정의 필드의 다중 선택 옵션이 WPML의 문자열 번역에서 번역되지 않습니다.

임시 해결 방법

진행하기 전에 사이트의 전체 사이트 백업이 있는지 확인하세요.

1. 통합 플러그인(WPUM-WPML) 수정

  • …/wp-content/plugins/wpum-wpml/includes/class-wpum-wpml-fields.php 파일을 여세요.
  • 20번째 줄을 찾으세요.
  • 변경 전:
    PHP
    add_action( 'update_wpum_field_meta', array( $this, 'update_meta_strings' ), 10, 4 );
  • 변경 후:
    PHP
    add_action( 'updated_wpum_field_meta', array( $this, 'update_meta_strings' ), 10, 4 );
  • 그 후, 사용자사용자 정의 필드로 이동하여 다중 선택 필드 옵션 중 하나 이상을 편집한 다음, WPML문자열 번역으로 이동하여 값을 번역하세요.

2. WP User Manager에서 프런트엔드 출력 수정

  • …/wp-content/plugins/wp-user-manager/includes/fields/types/class-wpum-field-multiselect.php 파일을 여세요.
  • 56번째 줄을 찾으세요.
  • 전체 get_formatted_output() 함수를 다음으로 교체하세요:
    PHP
    public function get_formatted_output( $field, $value ) {
    
        $stored_field_options = $field->get_meta( 'dropdown_options' );
        $stored_options       = array();
        $stored_index         = array();
    
        // Keep the plugin's own guard.
        if ( ! is_array( $stored_field_options ) ) {
            return '';
        }
    
        foreach ( $stored_field_options as $key => $stored_option ) {
            $val                    = isset( $stored_option['value'] ) ? $stored_option['value'] : $key;
            $lbl                    = isset( $stored_option['label'] ) ? $stored_option['label'] : '';
            $stored_options[ $val ] = $lbl;
            $stored_index[ $val ]   = $key;
        }
    
        $values = array();
    
        // Keep the plugin's (array) cast.
        foreach ( (array) $value as $user_stored_value ) {
            if ( ! isset( $stored_options[ $user_stored_value ] ) ) {
                continue;
            }
    
            $label = $stored_options[ $user_stored_value ];
            $index = isset( $stored_index[ $user_stored_value ] ) ? $stored_index[ $user_stored_value ] : 0;
    
            $translated_label = apply_filters(
                'wpml_translate_single_string',
                $label,
                'wpum-fields-wpum-field-' . $field->get_ID(),
                'wpum-field-dropdown_options_' . $index
            );
    
            $values[] = $translated_label;
        }
    
        return implode( ', ', $values );
    }

모든 알려진 문제

이 문제에 대한 도움이 필요하십니까?

지원 문의를 하시면 저희가 함께 살펴보겠습니다.