You can add this code to the functions.php file of your active language.
this will change the default behavior of having newly registered users from having the default site language to the language they were using at the time they registered their account.
function wpml_get_code( $lang = "" ) { $langs = icl_get_languages( 'skip_missing=0' ); if( isset( $langs[$lang]['default_locale'] ) ) { return $langs[$lang]['default_locale']; } return false; } function users_language( $user_id ){ $current_language = apply_filters( 'wpml_current_language', NULL ); update_user_meta( $user_id, 'icl_admin_language', $current_language ); update_user_meta( $user_id, 'locale', wpml_get_code($current_language) ); } if( !function_exists('is_plugin_active') ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } if( is_plugin_active('sitepress-multilingual-cms/sitepress.php') ){ add_action( 'user_register', 'users_language'); add_action('personal_options_update', 'users_language' ); add_action('edit_user_profile_update','users_language' ); }
Let us know if this snippet is not working for you:
This snippet doesn’t work