We are facing this error:

PHP Fatal error:  Uncaught Error: Call to undefined function get_locale() in /var/www/html/wp-includes/l10n.php:137
Stack trace:
#0 /var/www/html/wp-includes/l10n.php(828): determine_locale()
#1 /var/www/html/wp-includes/class-wp-fatal-error-handler.php(46): load_default_textdomain()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
  thrown in /var/www/html/wp-includes/l10n.php on line 137

The error occurs since the major update to 5.5, or 5.5.1 respectively. A hotfix we found is replacing the l10n.php file on the webserver with the freshly downloaded one from wordpress, but after some time (roughly a day) the error will come up again. This happened several times in a row now. Things tested:

  • Disabling all Plugins
  • Change Theme
  • Manually update Wordpress Core
  • Installing Wordfence

Can this error be caused by a plugin conflict or a theme error, and then maintain while the plugins are disabled and theme changed?

  • What does l10n.php look like when the error happens, before you replace it? Is it empty, is there bad code at the top, have you lost half the file, something else? Nothing should be overwriting core files in normal usage, but some WordPress hacks work by editing themselves into existing files, and it's possible this is a hack accidentally breaking the site. You could always change file permissions so that WordPress cannot write to l10n.php, and handle updates manually, but you probably do want to work out what's doing this.
    – Rup
    Sep 7 '20 at 8:24
  • The file is exactly the same, but by replacing it, it works again for a limited amount of time
    – Niklas
    Sep 7 '20 at 8:31
  • Hmm. I'd guess then that it's a problem with your PHP's bytecode cache - it's somehow losing its compiled copy of the code, and replacing the file triggers a recompile? - but I haven't heard of any problems like that. When it breaks you could try just resetting the file's timestamp with touch or similar to see if that fixes it. Or you could try a slightly different version of PHP if there's one available. But I'm just guessing sorry.
    – Rup
    Sep 7 '20 at 8:38

Please do one thing, download WordPress the same version and copy the wp-includes folder and replace the old one with this new wp-includes.

Everything will work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.