🔧 Flat-price WordPress fixes from $69 — start with a free diagnosis, no card. Get a free diagnosis →

Maintenance

How to Safely Test a PHP Upgrade on WordPress

Nov 20, 2026 · 8 min read · By the Mend engineering team

If you’re upgrading PHP on a WordPress site, the safest move is not to “just switch it” on production. First check compatibility, clone the site to staging, run the upgrade there, and watch for plugin, theme, and custom-code failures before touching the live site. If anything is already shaky, back up first and fix the weak points before you change PHP.

The tricky part is that a PHP upgrade often doesn’t break WordPress itself. It breaks old assumptions inside themes, plugins, and custom snippets that were working by luck on an older PHP version. That’s why one site upgrades cleanly while another immediately throws a critical error, white screen, broken checkout, or admin-only failure.

What you’ll usually see after a PHP upgrade goes wrong

When PHP and WordPress don’t agree, the symptoms are often confusing because the failure may be partial rather than total. Front-end pages can load while wp-admin fails, or the homepage might work while WooCommerce checkout, contact forms, or the block editor start erroring.

  • “There has been a critical error on this website”
  • Blank white pages on some templates or the entire site
  • 500 Internal Server Error after the PHP switch
  • Plugin-specific failures, such as forms not sending or sliders disappearing
  • Theme layout breakage, especially if the theme uses older custom code
  • Admin-only problems, like wp-admin loading but certain screens timing out
  • Checkout, search, or REST API issues that don’t show on the homepage

If the site is already down, start with the relevant recovery guide for the symptom you’re seeing: There Has Been a Critical Error on This Website, How to Fix the WordPress White Screen of Death, or How to Fix the WordPress 500 Internal Server Error.

Why PHP upgrades break WordPress sites

PHP changes matter because WordPress is a big ecosystem, not a single application. Core WordPress is usually compatible with newer PHP versions well before every plugin and theme is ready, and custom code is often the weakest link.

1. Old plugins or themes use outdated PHP functions

Some code that was tolerated in older PHP versions is deprecated or removed in newer ones. A plugin may still be “active” but rely on a function, syntax, or behavior that no longer works as expected. That can cause anything from warnings to fatal errors.

2. Custom snippets and child-theme code are often untested

Many sites have code added through functions.php, a custom plugin, a code snippets plugin, or a child theme. This code usually survives for years without anyone revisiting it, which makes it a common source of failures when PHP changes.

3. Hosting changes sometimes happen at the same time

Some hosts pair a PHP upgrade with changes to server modules, memory limits, or file handling. That means the problem you see may not be PHP alone. It could be PHP plus a host-level change that only shows up after the switch.

4. Caching can hide or delay the real failure

A page cache may keep serving old output, so everything looks fine at first. Then a cache clear, cron run, form submit, or uncached page reveals the actual error. That’s one reason a safe test needs real interaction, not just a homepage reload.

The safest way to prepare before upgrading PHP

Before you change anything, make a full backup you can actually restore. That means files and database, and ideally a backup you’ve tested recently. If your backup process is unproven, fix that first. A backup you can’t restore is not protection.

  1. Check compatibility reports

    Review your WordPress version, active plugins, theme, and any custom code. Look for vendor notes about supported PHP versions. If a plugin or theme hasn’t been updated in a long time, assume it needs extra scrutiny.

  2. Update WordPress core, plugins, and themes first

    Do this before the PHP change, not after. Most developers release compatibility fixes in WordPress updates, so upgrading the software stack first lowers the risk.

  3. Clone the site to staging

    Use a staging environment that mirrors the live site as closely as possible, including PHP version options, caching, and object cache if you use it. If your host doesn’t offer staging, create a safe clone on a separate subdomain or private environment.

  4. Switch PHP on staging only

    Change the PHP version there first and test the site like a real visitor and editor would. Open the homepage, blog posts, forms, search, login, wp-admin, checkout, account pages, and any custom templates or integrations.

  5. Turn on debugging on staging

    If something breaks, logging is your friend. On staging, enable WordPress debugging so you can capture the exact error instead of guessing. Keep it off on production unless you know why you need it and can safely handle log exposure.

  6. Check your error logs

    Look at both WordPress debug logs and server error logs. Fatal errors usually name the offending plugin, theme file, or custom function. That’s much faster than clicking randomly through the dashboard.

What to test before the live switch

A PHP upgrade test should cover more than “the homepage loaded.” The failures that matter most are often hidden in admin workflows or dynamic pages.

Area What to check Why it matters
Front page and posts Load several public pages, refresh, and clear cache Confirms basic rendering and template compatibility
wp-admin Open dashboard, editor, media library, menus, and settings Shows backend-only PHP errors early
Forms Submit contact, quote, or newsletter forms Plugins often fail on processing, not display
WooCommerce Browse products, cart, checkout, account pages Payment and checkout flows are high-risk during upgrades
Search and filters Use search, filters, and any AJAX features These often depend on custom PHP and API calls
Custom code Test any bespoke templates, shortcodes, or integrations Custom functionality is the most likely place for breakage

If the upgrade already broke the site, what to do next

Don’t keep toggling settings blindly. The safest path is to restore access, identify the failing code, and only then decide whether to revert PHP or repair the compatibility issue.

  1. Revert to the previous PHP version

    If the site went down immediately after the upgrade, rolling back PHP is usually the fastest way to restore service. This is not the final fix, but it buys you time.

  2. Check the exact error

    Read the error log or WordPress debug log. A fatal error typically points to a plugin file, theme file, or custom snippet. Fixing the actual cause is better than running an older PHP version forever if your host is pushing upgrades.

  3. Disable the offending plugin or theme

    If logs point to a plugin, disable it safely. If the failure is in the active theme, switch to a default theme if you can. If you can’t access wp-admin, use the file system or hosting panel carefully, and take a backup first.

  4. Remove or rewrite deprecated custom code

    Older syntax and functions often need a small rewrite. If the broken code is in a custom plugin or child theme, repair it in staging, not live.

  5. Retest after each change

    Change one thing at a time. If multiple fixes are applied together, you won’t know which one solved the problem, and that makes future troubleshooting harder.

How to avoid PHP upgrade surprises in the future

The best defense is to make PHP version changes routine instead of emergency work. That means keeping the site current, testing on staging, and not letting stale plugins accumulate for years.

  • Use a staging workflow for every major PHP change
  • Keep WordPress core, plugins, and themes updated regularly
  • Remove plugins and themes you don’t actually use
  • Document any custom code and who wrote it
  • Test your backups by restoring them occasionally
  • Keep an eye on hosting notices about upcoming PHP deprecations

If you want a broader system for staying ahead of problems like this, What a Good WordPress Maintenance Routine Looks Like is a useful companion read, and PHP Version Upgrades: What Breaks and How to Prepare covers the same topic from a wider maintenance angle.

When to call a professional

Bring in a professional if the site is live, revenue-generating, or already showing fatal errors and you need it fixed without guesswork. It’s also worth getting help if you see repeated crashes after rolling back PHP, can’t identify the failing plugin or snippet, or the site depends on custom code you don’t fully understand.

Mend can handle this the way it should be handled: backup first, diagnose the actual cause, fix it fast, and tell you exactly what changed. If you’re stuck, start with a free diagnosis and get a flat quote before any work begins, or use Emergency Rescue if the site is down right now. If you’d rather connect the site securely without sharing passwords, use Mend Connect.

The right PHP upgrade is the one your site survives without drama. Test first, watch the logs, and don’t assume the problem is “just PHP” until you’ve checked the code that runs on top of it.

Frequently asked questions

What PHP version should I upgrade to on WordPress?

Use the newest version your host supports and your plugins/themes explicitly support. If anything critical is not compatible yet, fix that first on staging before moving live.

Can I tell if PHP is the cause of a WordPress error?

Often yes, if the problem starts immediately after the PHP switch and the error log points to a plugin, theme file, or deprecated function. If the logs are unclear, test by rolling back PHP and checking whether the error disappears.

Is it safe to upgrade PHP without a staging site?

It’s possible, but it’s not the safe approach. A staging copy lets you test real pages, admin screens, and checkout flows before the live site is affected.

Should I keep an old PHP version if the site works?

Only temporarily. Old PHP versions eventually stop receiving support, so the goal should be to update the code and site stack until you can run a supported version safely.