WordPress DB_* constants will be automatically defined for PHP 8 compatibility

For PHP versions 8.0 and newer, accessing an undefined constant will result in a fatal error — in older versions, it triggered a warning. To ensure utmost compatibility during our PHP 8.0 update path, we will be automatically defining the below constants on Tuesday, October 4 for all production WordPress environments:

  • DB_NAME
  • DB_HOST
  • DB_USER
  • DB_PASSWORD

This change is currently enabled for all non-production WordPress environments. We highly recommend checking your codebase to see if/how any of the above constants are being accessed to assess potential impacts.

It was not defined by default due to VIP’s drop-in usage of HyperDB and was not needed on older PHP versions (< 8.0). For more information on updating PHP 8 on WordPress VIP, please see our guide on getting started.