Index translated WPML author display_name strings
-
Hello!
Relevanssi is indexing Englishdisplay_names for authors on non-english posts, Russian in our case.WordPress/WPML saves default user details as English with translations available through the WPML String Translations plugin. All our users’ first, last, and display names are correctly and fully translated through WPML and appear correctly on the front end in the post metas box: in English on English posts, and in Russian on Russian posts. However, when indexing posts, Relevanssi is picking up only the English
display_names for all posts irrespective of the post language, so searching for an author’s name in Russian on the Russian version of the site yields no results.I’ve tried setting up a filter based on examples from Relevanssi and WPML (see code below), but it doesn’t do what I want. How do I make Relevanssi index the Russian
display_nametranslations for Russian posts?Code tried (in current theme’s
functions.php):add_filter( 'relevanssi_post_author', 'rlv_translated_author_names', 10, 2 );function rlv_translated_author_names( $post_author, $post ) {
if(ICL_LANGUAGE_CODE=='ru') {
$post_author = apply_filters( 'wpml_translate_single_string', $post_author, 'Authors', 'Display Name', 'ru' );
}
return $post_author;}
The topic ‘Index translated WPML author display_name strings’ is closed to new replies.