Uncaught Error: Call to undefined function trailingslashit()

Did your try to update PHP to version 7.4, or 8.0. or 8.1 and your website goes down with an http error 500 and the following message?

Fatal error: Uncaught Error: Call to undefined function trailingslashit() in /home/www/public_html/wp-includes/class-wp-textdomain-registry.php:103 Stack trace: #0 /home/www/public_html/wp-includes/l10n.php(784): WP_Textdomain_Registry->set('default', 'it_IT', '/home/www/...') #1 /home/www/public_html/wp-includes/load.php(1401): load_textdomain('default', '/home/www/...', 'it_IT') #2 /home/www/public_html/wp-includes/load.php(162): wp_load_translations_early() #3 /home/www/public_html/wp-settings.php(37): wp_check_php_mysql_versions() #4 /home/www/public_html/wp-config.php(77): require_once('/home/www/...') #5 /home/www/public_html/wp-load.php(50): require_once('/home/www/...') #6 /home/www/public_html/wp-blog-header.php(13): require_once('/home/www/...') #7 /home/ww23xa7a/public_html/index.php(17): require('/home/www/...') #8 {main} thrown in /home/ww23xa7a/public_html/wp-includes/class-wp-textdomain-registry.php on line 103

Please follow the instructions below to fix this error:

  • Download the latest WordPress version file and unzip, then replace the folder wp-includes This can fix the problem with the undefined function trailimgslashit().
  • Add the line define ('WP_ALLOW_REPAIR', true); to the file wp-config.php. Then open example.com/wp-admin/maint/repair.php and follow the steps in the repair dialog to bring back your website.