To fix a WordPress 502 error, reload the page and try another connection. A 502 Bad Gateway means a gateway or proxy received an invalid response from the upstream server.
For a small business, that failure can interrupt lead generation and leave clients unable to enquire. If the error page still appears, investigate plugins, PHP and hosting. Start with reversible checks, then make one controlled change at a time.
Key takeaways
- Rule out browser and connection problems before editing WordPress.
- Back up files and the database before changing plugins, PHP or configuration.
- Match failures to logs, and involve your hosting provider when the evidence points beyond WordPress.
1. Start with quick browser and connection checks
Reload and test another browser
Press F5 or Control+F5 on Windows, or Command+R on Mac. A temporary server problem may already have cleared.
Next, open the page in a private window or another browser. If that works, clear browser cache and cookies for the affected site, then reload the page.
Browser extensions can also interfere. In Chrome, open the three-dot menu, then Extensions > Manage Extensions. Older versions place Extensions under More tools. Disable extensions individually and repeat the same test after each change.
Try mobile data and clear local DNS
Switch your phone from Wi-Fi to mobile data, or connect your computer through a phone hotspot. If the page works there, investigate your original network or ISP connection.
After a hosting move, DNS changes may take time to resolve. A stale DNS cache can keep your device pointed at the old server, so clear your local DNS cache if the problem affects only your connection:
On Windows, open Command Prompt as administrator and run ipconfig /flushdns.
On Mac, open Terminal and run sudo killall -HUP mDNSResponder. Enter your administrator password when prompted.
These checks isolate local problems. They won’t repair a crashed website server.
What causes a WordPress 502 error?
A 502 belongs to the 5XX server-side error family. By contrast, 4XX codes describe client-side request errors.
Four common causes are overloaded servers, proxy server problems, DNS misconfigurations and backend failures, including software crashes or hardware faults. In WordPress, a plugin or theme can also trigger a failure by exhausting resources or disrupting PHP processing.

A campaign traffic spike can exhaust available PHP workers. Meanwhile, incorrect DNS records can send a proxy to the wrong origin server.
The error identifies where communication failed, but doesn’t name the underlying cause. If the response changes to HTTP 500, use our WordPress server-error troubleshooting rather than assuming the same repair applies.
2. Protect the site and establish the scope
Before changing anything, download a backup of both WordPress files and the database. Include wp-config.php, wp-content and hidden files such as .htaccess.
Record the affected URL, exact failure time and time zone. Then test the homepage, an internal page and /wp-admin/ separately. Note recent updates, deployments and PHP changes.
Also check the administrator inbox for a WordPress Recovery Mode email. Its protected link may restore access after certain plugin or theme failures.
Use staging for disruptive tests where possible. Disable outgoing emails and automated customer actions on the staging copy.
3. Isolate plugin and theme conflicts
Disable plugins without dashboard access
To isolate WordPress plugins, start with one identified in the logs. If there isn’t one, use your hosting File Manager or SFTP:
- Record which plugins are active, then rename
wp-content/pluginstoplugins.hold. - Reload
/wp-admin/plugins.phpwhilst the folder remains renamed. If WordPress loads, it recognises the missing plugins as deactivated. - Restore the folder’s original name,
plugins. - Reactivate plugins individually, testing the failing request after each activation.
Don’t delete plugin folders or run uninstall routines. If renaming changes nothing, restore the original name before continuing.
This test doesn’t disable must-use plugins or all caching drop-ins. Those need separate investigation.
Test the theme and recent custom code
If ordinary plugins aren’t responsible, test an installed, compatible default theme from your WordPress themes on staging. A successful test points towards the original theme, child theme or related custom code.
Avoid casually switching the live theme because navigation, forms and page layouts may change.
For a fault following custom web development, roll back the relevant deployment through your established process. Retest before making further changes.
The last plugin activated may expose a conflict with another component. It isn’t automatically the only faulty plugin.
4. Check PHP timeouts and hosting resources
PHP’s max_execution_time sets how many seconds a script may run before PHP stops it. Reaching that limit can produce a 502, depending on how the hosting stack handles the failure.
Long imports, backups or external API requests deserve attention when failures occur during those tasks. Increasing the timeout without finding the slow operation can leave requests consuming resources for longer.
Similarly, PHP’s memory_limit controls script memory. Increase it only when logs show exhaustion and the hosting account has enough capacity.
A traffic spike can exhaust capacity and leave an overloaded server unable to respond. Ask hosting support to check logs, CPU usage, storage, PHP worker availability and service crashes.
If the problem followed a PHP version change, test a compatible supported version. On SiteGround, this is available through Site Tools’ PHP Manager. Standard WordPress doesn’t include a PHP version switch.
A temporary rollback can restore service, but repair incompatible code rather than retaining an unsupported PHP release.
5. Enable WordPress logging safely
Start with the PHP and web-server error logs available through your hosting account. Match the failure timestamp rather than chasing unrelated warnings.
If more evidence is needed, back up wp-config.php. Before its stop-editing comment, edit existing definitions or add missing ones:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Don’t duplicate definitions. These settings enable logging to wp-content/debug.log whilst keeping WordPress debug messages off public pages. The WordPress debugging documentation explains their behaviour.

Reproduce the failure once, then retrieve the log securely. If PHP never reaches WordPress, this file may contain nothing useful, so hosting logs remain important.
Restrict access because logs can expose server paths and sensitive information. Afterwards, set WP_DEBUG back to false, remove temporary logging settings and securely delete unneeded diagnostic files.
6. Investigate CDN, proxy and server configuration
Temporarily bypass Cloudflare
If a CDN such as Cloudflare fronts your site, open the domain’s Overview page, then Advanced Actions > Pause Cloudflare on Site. The pause can take up to five minutes to take effect, according to Cloudflare’s pause instructions.
Only do this when the origin can accept direct traffic. Pausing removes the service’s protection, so keep the test brief.
If access returns, investigate the connection between the service and your origin. Check DNS records and origin name resolution, and see whether a stale DNS cache is sending requests to the wrong address. Review firewall events and origin availability, then re-enable the service after testing.
For another CDN provider, use its equivalent controlled bypass process.
Inspect conflicting server rules
On Apache or compatible servers, caching and compression plugins may write rules into .htaccess.
A WPMU DEV support case linked a dashboard 502 to Far Future Expiry Header and Hummingbird both adding GZIP rules. Replacing the conflicting contents with default WordPress rules restored access in that case.
That isn’t a universal repair. Back up .htaccess and preserve custom redirects and security rules before a targeted correction.
Nginx doesn’t use .htaccess. Server configuration failures need investigation at the hosting layer, rather than repeated edits inside WordPress.
7. Know when to contact your hosting provider
Contact your host promptly for a business-critical outage. Escalate when quick checks and plugin tests fail, or when the error repeatedly returns.
Send the affected URL, timestamp and time zone, a screenshot, relevant log excerpts and changes already attempted. Include whether public pages, dashboard requests or both fail.
The hosting provider can inspect platform-level logs, resource limits and backend services that WordPress administrators can’t access.
Stop speculative configuration edits when the evidence runs out. For agencies needing a technical partner for client websites and hosting, See how we collaborate with creative agencies.
8. Prevent repeat failures and test recovery
After repair, clear the relevant WordPress, hosting and CDN caches. Then test logged out as well as logged in.
Submit a marked test enquiry, check booking or checkout journeys, and confirm automated follow-ups behave correctly. Also inspect the mobile-responsive layout after plugin or theme changes.
Test landing pages used by email marketing, social media and your Google Business Profile before resuming campaigns.
Ongoing website care and maintenance should include tested backups, controlled updates and resource monitoring. Put rollback ownership and escalation responsibilities in your website support plan.
Persistent 502s can slow Google’s crawling and eventually cause pages to leave its index. A brief outage doesn’t automatically remove them. Google’s crawling-error guidance supports investigating server availability when troubleshooting SEO problems.
Frequently asked questions
Is a 502 error my fault as a visitor?
Usually, no. It’s a server-side response. Try another browser and connection, but if the website fails across both, its owner needs to investigate.
Why does the homepage work whilst wp-admin fails?
A CDN or page cache may serve a saved homepage whilst dashboard requests need live PHP processing. Test uncached actions before declaring recovery. Admin-only plugins, resource-intensive requests or configuration conflicts can explain the difference.
Can a plugin cause a 502 on otherwise healthy hosting?
Yes. Faulty or incompatible code can crash processing, exceed limits or create conflicting rules. The hosting infrastructure doesn’t need a hardware fault.
Restore service with evidence, then retest
A WordPress 502 error, also called a 502 Bad Gateway error, is easier to resolve when each change follows a clear clue. Start locally, protect your data, then isolate WordPress components and hosting failures.
Treat recovery as complete only after real customer journeys work again. Record the cause and successful repair so the next incident has a useful starting point.