問題の概要
WPMLでPublishPress Authorsを使用すると、次の問題が発生する場合があります。文字列翻訳で著者のプロフィールを翻訳しても、翻訳された投稿ではプロフィールがデフォルト言語のまま表示されます。
回避策
このコードをテーマのfunctions.phpファイルまたはコードスニペットプラグインに追加し、WPML文字列翻訳でプロフィールを翻訳します(ドメイン PublishPress Authors):
PHP
add_filter( 'publishpress_authors_author_attribute', function ( $value, $term_id, $attribute ) {
if ( 'description' !== $attribute || ! is_string( $value ) || '' === $value ) {
return $value;
}
return apply_filters( 'wpml_translate_single_string', $value, 'PublishPress Authors', '#' . (int) $term_id . ' Biographical Info' );
}, 10, 3 );