title: Login redirection with WPML
body: <p>This code only works for the default language, since ICL_LANGUAGE_CODE returns </p>
  
  <p>only the default language code in login_rediraction. </p>
  
  <p>How can I get a second language?   </p>
  
  <pre><code>function my_login_redirect( $url, $request, $user ){
      $langs =  ICL_LANGUAGE_CODE;
      if( $user &amp;&amp; is_object( $user ) &amp;&amp; is_a( $user, 'WP_User' ) ) {
          if( $user-&gt;has_cap( 'marketing')) {
              if($langs == 'en'){
                  $url = home_url('/en-slug/');
              }else{
                  $url = home_url('/fr/fr-slug/');
              }
          }
      }
      return $url;
  }
  add_filter('login_redirect', 'my_login_redirect', 10, 3 );
  </code></pre>