PHP 8 breaking WordPress

PHP 8 breaking WordPress

Did your host update PHP without telling you? Did you WordPress that has worked for years all of a sudden stop working?

PHP 7.4 is officially end of life since Nov 28th 2022.

The good news is we can help with your PHP 8 upgrades. Not only 8.0 but 8.2 introduces more breaking changes. Below are a few changes that might be causing your WordPress site to break after an PHP upgrade.

  1. Constructor Property Promotion: PHP 8 introduces constructor property promotion, which allows class properties to be defined and initialized in a constructor argument list. This may affect WordPress plugins that rely on specific constructor patterns.
  2. Named Arguments: PHP 8 introduces named arguments, which allows function arguments to be passed by name instead of position. This may affect WordPress plugins that rely on specific function argument order.
  3. Union Types: PHP 8 introduces union types, which allows type hints to specify that a parameter or return value can be one of several different types. This may affect WordPress plugins that rely on strict typing.
  4. Removal of Deprecated Features: PHP 8 removes several deprecated features that may have been used by WordPress or WordPress plugins. For example, the “create_function()” function is no longer available in PHP 8.
  5. Changes to Error Handling: PHP 8 introduces changes to error handling, including the removal of the “E_NOTICE” error level and changes to how errors are displayed. This may affect WordPress plugins that rely on error handling or logging.

These changes may require updates or modifications to WordPress or WordPress plugins to ensure compatibility with PHP 8. It is important to thoroughly test any code changes before deploying them to a production environment.