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 risposte a “bbPress – Language switcher not working on user pages”

Lasciare una risposta

Vi preghiamo di lasciare qui solamente i commenti per questa pagina.
Per assistenza tecnica e suggerimenti sulle funzionalità, andate sul nostro forum. Vi aspettiamo lì!

Potete usare questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>