Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not change site language in Wordpress

Tags:

wordpress

I'm trying to set the german language for the Wordpress backend. German is also installed and can be selected under:

Settings> General> Site Language

Unfortunately it jumps back to English when saving.

My attempts so far:

The following did not work (for me):

  1. wp_config.php WPLANG set and also removed
  2. Looking at the database by setting, it is set to de_DE
  3. Loco Translate installed and viewed. There, too, like the Site Language, it is output as English. Loco removed again. No WPML/Loco installed.
  4. Checked for language updates, there were none.
  5. Installed formal German and tried to select.
  6. Language files controlled by FTP. Only German available, no EN.
  7. Check latest Wordpress 5.8.
  8. No Errors in Log Files
  9. Test .htaccess, wp-content, wp-content/languages and all other subfolders of wp-content set to 777. Only for a sec. Really.
  10. Deactive all Plugins
  11. Other settings such as the time (UTC + 2) could be changed and saved
  12. Activate all WordPress debug mode for developers. Nothing
  13. define('FS_METHOD', 'direct'); doesnt help
  14. Check WP site-health.
  15. Browser-Language set to german
  16. Try another Browser

The following did work:

  1. Installed and activated a Wordpress original theme "Twenty One" as a test
like image 852
Julian Avatar asked Oct 27 '25 12:10

Julian


1 Answers

Since only the theme change worked, it had to be due to the theme. So I scoured the files and found it here:

The code says, and this was confirmed to me by support when I asked, that if "Deactivate translations" is not active in the theme options, absolute is set to en_US.

function et_divi_maybe_change_frontend_locale( $locale ) {
    $option_name   = 'divi_disable_translations';
    $theme_options = get_option( 'et_divi' );

    $disable_translations = isset ( $theme_options[ $option_name ] ) ? $theme_options[ $option_name ] : false;

    if ( 'on' === $disable_translations ) {
        return 'en_US';
    }

    return $locale;
}
add_filter( 'locale', 'et_divi_maybe_change_frontend_locale' );
like image 105
Julian Avatar answered Oct 29 '25 06:10

Julian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!