Open

Topic Tags: Language Switcher

Symptoms

Using the language switcher to navigate to the secondary language(s) page does not work on the user’s page.

Workaround

To resolve this issue add the snippet below to the functions.php file found in your theme’s folder.

bbPress user language switcher fix
add_filter( 'icl_ls_languages', 'bbpress_user_ls_fix' );

function bbpress_user_ls_fix( $languages ) {
        global $wp_query;

        if ( bbp_is_single_user_profile() ) {
                foreach ( $languages as $code => $language ) {
                        $home = trailingslashit( get_home_url() );
                        do_action( 'wpml_switch_language', $code );
                        $lang_url = trailingslashit( apply_filters( 'wpml_home_url', $home ) );
                        $url = str_replace( $home, $lang_url, bbp_get_user_profile_url() );
                        $languages[ $code ]['url'] = $url;
                }
                do_action( 'wpml_switch_language', ICL_LANGUAGE_CODE );
        }
        return $languages;
}

23 Respostas para “bbPress – Language switcher not working on user pages”

Deixar uma Resposta

Por favor deixe comentários somente sobre esta página.
Para suporte técnico e sugestão de funcionalidades, vá para nosso fórum. Esperamos você lá!

Você pode usar estas tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>