WPML
apply_filters( $custom_field_val, $custom_field_name )
タイプ
filter
WPMLバージョン
4.1.0

説明

カスタムフィールドは、WPMLが解釈できない形式でエンコードされている場合があります。WPMLで翻訳する前に、これらのフィールドをデコードおよびエンコードする必要があります。これを行うには、wpml_decode_custom_fieldおよびwpml_encode_custom_fieldフィルターを使用する必要があります。これらのフィルターは、WPMLがすでに処理しているものに加えて、追加のカスタムエンコーディングがある場合に使用できます。

引数

$custom_field_val
エンコードする必要があるフィールドに含まれる値
$custom_field_name
エンコードする必要があるフィールドの名前

使用例

add_filter( 'wpml_encode_custom_field', 'my_encode_function', 10, 2 );

function my_encode_function( $custom_field_val, $custom_field_name ) {
   if ( $custom_field_name === 'my-special-field' ) {
      $custom_field_val = my_special_encoding_function( $custom_field_val );
   }

  return $custom_field_val;
}

wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages

すべてのサイト全体の言語情報フック(29件) →