What PHP 8.0 Compatibility Means for Your WordPress Site
PHP 8.0 brought substantial changes to the language that affect how WordPress sites run. For site owners, understanding PHP 8.0 compatibility is essential before making any version upgrade decisions. PHP 8.0 introduced named arguments, union types, attributes, and match expressions, alongside breaking changes that can cause fatal errors in code written for earlier PHP versions.
The upgrade path from PHP 7.4 to PHP 8.0 can be smooth if you audit your theme, plugins, and custom code first. Many well-maintained plugins handle PHP 8.0 without issues, but older plugins, niche themes, and bespoke code often need attention. Rushing the upgrade without proper testing typically leads to site downtime or mysterious errors that are difficult to diagnose under pressure.
This guide walks through the practical steps to check your WordPress site for PHP 8.0 compatibility, test safely, and decide when the upgrade makes sense for your setup.
The WordPress PHP Version Support Landscape
WordPress core itself supports PHP 8.0 and newer versions, but the broader ecosystem moves at different speeds. Premium themes and plugins from established developers usually update quickly to support current PHP versions. Free plugins from the WordPress repository vary widely: some are actively maintained with PHP 8 support, others have not been updated in months or years and may break without warning.
The first practical step is auditing what you have installed. In the WordPress admin, navigate to Plugins and document every active plugin, its version number, and the date it was last updated. Any plugin that has not received an update in over six months is worth investigating further for PHP 8 compatibility.
Beyond plugins, note your active theme and any custom code added to your site, whether through a child theme, a custom plugin, or code snippets in your functions.php file. Custom code is often the source of compatibility issues because it was written quickly for a specific purpose and may not have been revisited since.
Checking Plugin Compatibility Before Upgrading
Before upgrading PHP on your production server, test compatibility thoroughly in a staging environment. Never upgrade PHP on a live site without confirming everything works first. This is one of the most important practical rules for any PHP version upgrade.
The PHP Compatibility Checker plugin, developed by WP Engine, scans your installed plugins and theme for known compatibility issues with different PHP versions. It is not perfect and cannot catch every possible problem, but it reliably identifies the most common breaking changes that affect WordPress sites.
You can also use WP-CLI to list your active plugins for documentation purposes:
wp plugin list --status=active --format=table
For each plugin on your site, check the WordPress repository page or the developer's website for explicit PHP 8.0 compatibility statements. Many developers include this information in their documentation or changelog. If a plugin has no mention of PHP 8 support, treat it as potentially incompatible until proven otherwise.
If a plugin is incompatible, look for an alternative that provides similar functionality and is actively maintained. Replacing an incompatible plugin is usually faster than waiting for a developer to release a compatibility update, particularly for smaller or abandoned plugins.
Common PHP 8.0 Breaking Changes in WordPress Code
Several PHP 8.0 changes commonly affect WordPress themes and plugins. Understanding these helps you interpret error messages and decide whether a fix is straightforward or requires significant developer attention.
Required Parameters After Optional Parameters
In PHP 8.0, if a function includes optional parameters, they cannot be followed by required parameters. This produces a fatal syntax error that prevents the file from loading entirely. This is one of the most common breaking changes affecting WordPress code.
// This causes a fatal error in PHP 8.0
function example($optional = 'default', $required) { }
// Correct approach: required parameters come before optional ones
function example($required, $optional = 'default') { }
If your theme or a plugin contains this pattern, you will see a white screen or a parse error immediately after upgrading PHP. The fix is usually straightforward reorder the parameter list but requires access to the code.
Dynamic Property Assignments
PHP 8.0 deprecated dynamic properties on objects that do not explicitly allow them, except for stdClass. In PHP 8.0 this produces a warning, but in PHP 9.0 it will become a fatal error. Code that assigns properties to objects dynamically without declaring them needs to be updated.
// Deprecated in PHP 8.0, will error in PHP 9.0
$object->dynamicProperty = 'value';
// Correct approach: declare the property explicitly
class MyClass {
public string $dynamicProperty = '';
}
$object = new MyClass();
$object->dynamicProperty = 'value';
MySQL Extension Removal
The old mysql_* functions were removed in PHP 7.0, so they should not appear in any modern code. However, some very old plugins or custom themes written years ago may still use them. Any code calling mysql_connect, mysql_query, or similar functions will fail completely in PHP 8.0.
If you encounter these functions in your codebase, the plugin or theme using them is severely outdated. Finding alternatives is almost always the better option than attempting to patch legacy database code.
Other Notable Changes
PHP 8.0 also changed how certain string-to-number comparisons work, modified the behaviour of the @ operator for suppressing errors, and made the implode function's parameter order consistent. These changes affect fewer sites but can still cause subtle bugs that are difficult to spot without thorough testing.
Setting Up a PHP 8.0 Test Environment
The safest way to verify PHP 8.0 compatibility is to set up a staging environment running PHP 8.0 and use your site normally while watching for errors. This removes all risk to your production site while giving you accurate information about what works and what does not.
If you use a managed WordPress host that offers PHP version switching, use their staging environment feature to clone your site and switch it to PHP 8.0. Most managed hosts allow you to change PHP versions per environment without affecting your live site. This is often the simplest approach if your host supports it.
For VPS or dedicated server setups, you can install PHP 8.0 alongside your current version and test in isolation:
# Install PHP 8.0 alongside existing PHP version
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.0-fpm php8.0-mysql php8.0-xml php8.0-mbstring php8.0-curl
# Configure a separate Nginx or Apache vhost to use PHP 8.0 for testing
# Or use PHP-FPM pools with different versions running on different ports
Enable error logging and display during testing so you see any PHP warnings or errors as they occur:
// Add to wp-config.php for testing purposes only
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
@ini_set('display_errors', 1);
Remove these debug settings or set them to false before deploying to production. Leaving debug mode enabled on a live site can expose sensitive information and affect performance.
Testing Your Theme and Plugins for Compatibility
Use the Health Check and Troubleshooting plugin to run additional compatibility checks across your site. Enable debugging mode and actively use your site during testing: visit the homepage, open posts, view pages with custom templates, navigate the admin dashboard, and test any custom post type functionality.
Check PHP error logs regularly during testing:
tail -50 /var/log/php_errors.log | grep -i error
Common symptoms of PHP 8.0 incompatibility include the white screen of death where the site displays nothing, headers already sent errors appearing at the top of pages, deprecated warnings appearing in your debug log, plugin settings pages failing to load or displaying blank content, custom post types refusing to save, and the media library failing to load images.
If you encounter any of these symptoms, note the specific page or action that triggers the error. This information helps narrow down which plugin or theme is responsible and whether the fix is likely to be simple or complex.
Handling Incompatible Code
When testing reveals incompatible code in a plugin or theme, several options are available depending on the severity and your technical capacity.
Replace the plugin or theme. If an actively maintained alternative exists that provides the same functionality, switching is usually the fastest path forward. This avoids waiting for updates and removes the maintenance burden of patched code.
Contact the developer. Many developers respond quickly to compatibility reports, particularly for popular plugins. Filing a support ticket with specific error messages and your PHP version helps developers reproduce and fix the issue.
Use a PHP compatibility shim. For minor issues, the php-compat-lib library or appropriate polyfills can provide backward compatibility as a temporary measure. This is useful when no immediate alternative exists and the plugin is business-critical.
Commission a fix. If the plugin serves an essential purpose and has no viable alternative, a developer can fix the compatibility issues directly in your codebase. Review the scope of required changes before committing to this path, as some fixes are straightforward while others touch multiple files.
When to Upgrade PHP
PHP 8.0 offers measurable performance improvements over PHP 7.4, which itself is significantly faster than earlier versions. For sites that perform heavy PHP processing, the performance improvement from upgrading can be noticeable. PHP 8.1 and PHP 8.2 offer further incremental improvements if your hosting supports them.
Do not upgrade PHP simply because a new version exists. A successful upgrade requires all of the following to be in place:
- Confirmed compatibility: Your theme and all active plugins work correctly under the target PHP version.
- Staging verification: You have tested on a staging environment and resolved any errors.
- Hosting support: Your hosting environment supports the PHP version you want to use.
- Rollback plan: You can revert quickly if something goes wrong on production.
If your current setup works reliably and is secure, staying on PHP 7.4 while the ecosystem matures is a reasonable choice. Many hosting providers continue supporting PHP 7.4 alongside newer versions, giving you time to test and plan upgrades without pressure.
Upgrading PHP Safely
Once you have confirmed compatibility and tested thoroughly, follow a careful deployment process for the actual upgrade. Take a full backup of your site files and database before making any changes. Most managed hosts include this in their update process, but verify it is complete before proceeding.
If your host provides PHP version selection in their control panel, make the change during a low-traffic period and monitor your site immediately afterward. Keep a browser tab open showing your site and another showing your error log. If problems appear, you can usually switch back to the previous PHP version within minutes.
After upgrading, run through your site systematically: check the homepage, navigate several pages, test contact forms, verify the admin area loads correctly, and confirm that any e-commerce functionality processes orders properly. Waiting 15 to 30 minutes after the upgrade before considering it successful gives you time to notice any delayed errors.
Monitoring After the Upgrade
Even successful PHP upgrades benefit from close monitoring in the days following the change. Some compatibility issues only appear under specific conditions, such as when a particular plugin processes data, a scheduled task runs, or a specific page template loads.
Check your error logs daily for the first week after upgrading. Look for deprecated warnings, which indicate code that works now but may break in future PHP versions. Addressing these proactively keeps your site stable as you plan further upgrades down the line.
Next Steps for Your WordPress PHP Upgrade
Checking your WordPress site for PHP 8.0 compatibility involves auditing your plugins and theme, testing in a staging environment, fixing any issues you discover, and upgrading only when everything works correctly. Taking this methodical approach protects your site from unexpected downtime and gives you confidence in the upgrade result.
If you need help reviewing your current setup, prepare a short note with your website URL, hosting details, active plugins list, and any error messages you have seen before getting in touch. This information helps identify potential issues quickly and makes the review process more efficient.