How to Update PHP 7 to 8 on WordPress

Image 007 - How to Update PHP 7 to 8 on WordPress 3

Updating your WordPress site from PHP 7 to PHP 8 can provide significant performance and security improvements. PHP 8 was released in November 2020 and includes features like the JIT compiler for faster page loads, improved type declarations for better code quality, and security enhancements to protect against vulnerabilities.

While WordPress core is compatible with PHP 8, many plugins and themes still need to be tested and updated for full compatibility. In this guide, we’ll walk through the full process to safely update PHP and confirm plugin/theme compatibility on your WordPress site.

Why Update to PHP 8?

There are a few key reasons to update your WordPress site to use PHP 8:

  • Faster performance – PHP 8 provides up to twice the performance of PHP 7 in benchmarks. The major feature driving faster speeds is the JIT compiler that improves caching and optimization of scripts.
  • Better security – PHP 8 contains security improvements like stricter variable typing that makes it harder for attackers to inject malicious code. Keeping your site updated ensures you get fixes for newly discovered vulnerabilities.
  • Improved code quality – PHP 8 enforces more strict variable type declarations, making code easier to maintain. It also adds new functions and simpler syntax for improved code readability.
  • Future proofing – With PHP 7 reaching end-of-life, supporting PHP 8 ensures your site keeps working smoothly as plugins/themes are updated for compatibility.

Tip: Need a faster WordPress hosting without breaking the bank? I recommend Cloudways.

How to Update PHP on WordPress

The process to update to PHP 8 contains a few key steps:

1. Update WordPress Core

Make sure your WordPress core is updated to the latest version. This ensures maximum compatibility with PHP 8 before changing versions.

To update WordPress core, login to your site’s admin dashboard and navigate to Updates > Update Now. Click the Update Now button to install the latest WordPress version.

2. Backup Your Site

Always backup your site before making major changes like switching PHP versions. This gives you a restore point if anything goes wrong.

Use a plugin like UpdraftPlus to backup your entire site including the database, themes, plugins, and uploaded media. You can restore the full backup if issues occur after updating PHP.

3. Switch to PHP 8

The process to change the PHP version depends on your hosting environment:

  • Shared hosting – Contact your hosting provider to request PHP 8 be enabled for your account. This is the easiest option since they handle the technical details behind the scenes.
  • VPS or dedicated server – Switch your PHP version by updating configuration files like php.ini and restarting relevant services. This PHP 8 installation guide contains detailed steps.
  • Local development – Alter your local environment to use PHP 8 instead of PHP 7. The process depends on your local stack but often involves updating PHP configuration and restarting the web server.

4. Test Plugin & Theme Compatibility

With PHP 8 enabled, the next step is to thoroughly test your plugins, themes, and custom code works properly.

Activate all plugins, switch between themes, and visit key site pages to check everything functions correctly. Pay particular attention to site forms, admin dashboards, galleries, and functionality driven by plugins.

If you experience issues, check the plugin/theme developer’s website and support forums for updates that address PHP 8 compatibility.

5. Debug and Fix Incompatibilities

If plugins or themes throw errors after upgrading to PHP 8, debugging is required to fix the incompatibilities:

  • Review error logs from your PHP logs or site admin dashboard to pinpoint the problematic code triggering issues.
  • Search plugin/theme support forums for existing reports of the errors you are experiencing. There may already be known workarounds or fixes available.
  • For custom plugin/theme code, review PHP 8 backwards incompatible changes to understand what changes are needed.
  • As a last resort, you may need to replace plugins/themes that are not actively maintained or compatible with PHP 8.

After addressing errors, retest all functionality until your site is running smoothly.

Tips for Updating PHP Pain-Free

Here are some tips to ensure updating to PHP 8 is seamless:

  • Stage your changes – Use a staging site to test PHP 8 before changing production. This isolates changes away from live traffic.
  • Backup frequently – Backups give you an instant restore point if issues emerge during or after the PHP update.
  • Update gradually – Switch staging/development sites to PHP 8 first. Only update production after thoroughly testing and fixing errors on lower traffic environments.
  • Contact developers – Plugin/theme authors are often happy to provide PHP 8 compatibility fixes for active users. Reach out to them if you run into errors.


Updating to PHP 8 is straightforward with proper planning and testing. It provides faster page loads, improved security protections, better code quality, and ensures smooth compatibility as WordPress evolves.

The process involves updating WordPress core, backing up your site, switching to PHP 8, thoroughly testing all functionality, and addressing any plugin/theme errors that arise. Following these steps carefully will allow you to unlock the benefits of PHP 8 for your WordPress site.