Hosting & WordPressOctober 23, 2026

Learning how to fix 504 gateway timeout in WordPress starts with understanding what the error actually means. A 504 appears when one server acting as a gateway or proxy waits too long for another server to respond. On a WordPress site, that usually means PHP workers are overloaded, a plugin or query is hanging, or the connection between your CDN, web server and database has stalled. The visitor sees an error page, but the root cause is almost always a timeout somewhere behind the scenes.

This guide takes you through a calm, ordered diagnosis. You will start with the quick checks that rule out a temporary glitch, then move through plugin and theme testing, PHP settings, database and hosting issues, and CDN configuration. Most 504 errors are fixed without advanced skills, and even when you ultimately need your host involved, the steps here will let you hand them precise information instead of a vague report that your site is down.

What a 504 Gateway Timeout Error Really Means

Think of a 504 as a messenger who waited too long for an answer. Your visitor’s browser asks a gateway server — often a CDN, a load balancer or a reverse proxy — for a page. That gateway asks your origin server, which asks PHP, which asks the database. If any link in that chain takes longer than the gateway is willing to wait, the gateway gives up and returns a 504. The page was never generated, so there is nothing to show.

That chain is why the same error can have five different causes. A plugin can hang a PHP worker, a slow database query can stall PHP, a full server can leave no worker free to answer, and a CDN can time out while waiting for an origin server that is itself waiting on something else. Your job is to work out which link is slow, and the fastest way to do that is to test the links one at a time, starting with the cheapest checks.

One warning before you change anything: take a backup if you can reach the dashboard, and note the exact time the error started plus anything that changed shortly before it — a plugin update, a traffic surge, a scheduled backup or import. That timeline is gold for both your own diagnosis and any support ticket you open later.

How to Fix 504 Gateway Timeout in WordPress: First Checks

Start with the simplest possibilities before changing anything. Refresh the page after a minute or two, try a different browser or device, and check whether only one page fails or the whole site including the WordPress dashboard. A brief 504 during a traffic spike or server maintenance often clears on its own. Check your hosting provider’s status page and your uptime monitor as well, because a known outage saves you from troubleshooting a problem that is not yours to fix.

If the error appears only for you, clear your browser cache and test through a mobile connection to rule out a local network or DNS hiccup. If the whole site is down for everyone and stays down, work through the steps below in order. Do not skip ahead to PHP settings or hosting upgrades until you have ruled out a plugin conflict — that is the most common cause you can fix yourself, and it takes ten minutes to test.

  1. Wait two minutes and refresh. Brief 504s during traffic spikes or maintenance often clear on their own.
  2. Test from another device and network. A mobile connection rules out a local network or DNS problem.
  3. Check whether wp-admin is affected or only the front end, and whether one page or every page fails.
  4. Look at your host’s status page and your uptime monitor for a known outage.
  5. Note the time the error started and any plugin updates, imports or traffic surges just before it.

WordPress server settings shown while troubleshooting a 504 gateway timeout error

Rule Out Plugin and Theme Conflicts

Plugins are the most common trigger you can fix yourself. A poorly coded plugin, a heavy backup or security scan, or a WooCommerce extension running long queries can tie up all available PHP workers until requests time out. If you can still reach the dashboard, deactivate plugins in small groups and retest after each group. Start with the ones updated most recently, then backup, security and importer plugins, which are the usual suspects for long-running jobs.

If the dashboard is also down, connect by FTP or your host’s file manager and rename the plugins folder to disable everything at once, then restore plugins one by one. Rename the folder from plugins to plugins-old, test the site, then rename it back and reactivate plugins in small batches, testing after each batch. Work methodically and retest after each change rather than reactivating everything at once.

Themes can cause the same problem, especially after an update or when a theme runs complex queries on every page. Switching temporarily to a default WordPress theme such as Twenty Twenty-Four tells you quickly whether your theme is involved. Our guide on how to change a WordPress theme without losing content walks through that switch safely. Keep a note of which plugin or setting made the error disappear, and check for updates or a replacement before turning that item back on permanently.

Signs a Plugin Is the Culprit

A plugin is the likely cause when the error started right after an update, when it only appears on pages that use a particular plugin’s features, or when the site recovers the moment you deactivate a group of plugins. Backup plugins running during peak hours, security plugins doing full scans, and import tools processing large files are repeat offenders. If you find the culprit, check whether a newer version fixes the issue before you look for a replacement — a single buggy release is common, and the fix often lands within days.

Increase PHP Limits and Check Server Settings

If no single plugin is to blame, your site may simply need more time or resources to finish legitimate work. Low PHP execution time, memory limits, or too few PHP workers cause 504s on busy stores and membership sites, especially during checkouts, imports and report generation. Your host can raise max_execution_time and memory limits, or you may be able to adjust them in your hosting panel. Any change should be modest and paired with monitoring, because raising limits on an overloaded server only delays the crash.

Ask your host to check the server error logs as well. Logs often name the exact script that timed out, the upstream that failed to respond, and whether the web server or PHP-FPM stopped answering. On nginx setups, proxy and fastcgi timeout values may also need review by the host. Shared hosting plans have hard ceilings here, so repeated 504s under normal traffic are a strong signal that your site has outgrown its current plan.

How many PHP workers you need depends on your traffic and your plugins. A small blog with light traffic can run fine on a handful of workers, while a WooCommerce store with several visitors checking out at once needs far more. If your host tells you workers are exhausted during normal traffic — not a spike, not a sale, just an ordinary Tuesday — that is the clearest sign an upgrade is due. A plan change fixes the cause; raising timeouts alone only gives a slow site more time to be slow.

PHP timeout settings and error logs checked while fixing a WordPress 504 error

Fix Database, Cron, and Long-Running Tasks

A struggling database can stall every request behind it. Oversized or corrupted tables, a bloated autoloaded options table, and missing indexes on busy WooCommerce sites all slow responses until the gateway gives up. Your host can check for slow queries and database load. Within WordPress, limit post revisions, clear transients, and use a reputable optimization tool carefully, always with a fresh backup taken first and tested during a quiet period.

The autoloaded options table deserves a specific mention. Every option marked autoload loads on every single page request, so a table that has grown to several megabytes — often from plugins that store logs or settings there — adds a delay to everything. A database optimization plugin can show you the size and what is in it, but do not delete rows by hand unless you know exactly what they belong to. One wrong deletion can break a plugin’s settings.

Scheduled tasks are another quiet culprit. If WordPress cron jobs pile up because traffic is low or a job keeps failing and retrying, they can fire in a burst and overwhelm the server. Plugins that show cron events help you spot stuck or overdue tasks. Likewise, disable XML-RPC if you do not need it and protect the login page, because brute-force traffic wastes the same PHP workers your real visitors need and can push a marginal server into timeout territory.

Database Checks Worth Doing

  • Back up before any database optimization work, and test the backup.
  • Clear expired transients and limit stored post revisions.
  • Inspect scheduled cron jobs for stuck or repeated tasks.
  • Ask your host to check for slow database queries and table sizes.
  • Reduce bot traffic to login and XML-RPC endpoints.

Check Your CDN, Firewall, and DNS

If you use a CDN or a proxy firewall such as Cloudflare, the 504 may be generated at that layer when the proxy cannot get a timely response from your origin server. Temporarily pausing the CDN or testing the origin address directly, with your host’s help, shows whether the error still occurs without the proxy. Also confirm the CDN is pointing at the correct origin IP address, especially after a hosting migration, because a stale record guarantees timeouts.

Firewall timeouts deserve a look too. Some CDNs enforce a fixed limit, commonly around 100 seconds on free plans, for the origin to respond. Long-running admin tasks such as imports and bulk updates may exceed that limit even on a healthy server, which is why they are better run through your host’s tools or during quiet hours. If the 504 only appears during imports or bulk edits and never on normal page loads, a CDN timeout limit is a strong suspect.

DNS is the last link to check. After a migration, a DNS record pointing at the old server can leave the CDN talking to a machine that no longer hosts your site. Confirm the A record matches the IP address your host gives you, and allow time for DNS changes to spread if you have just updated them. Once the site is stable, keep the CDN enabled for visitors, monitor uptime for a few days, and document what fixed the issue for next time.

CDN and gateway settings checked to find the source of a WordPress 504 timeout

When to Contact Your Host — and What to Tell Them

Some 504s are not yours to fix. If the error affects the whole site, survives plugin deactivation and a theme switch, and the logs point at the server rather than a script, open a support ticket. The difference between a ticket that gets fixed in an hour and one that drags on for a day is the information you include.

Send them the exact time the error started, whether wp-admin is affected, which pages fail, what you already tested and what changed, and any error log lines you found. Tell them you have already ruled out plugins and themes, and ask specifically about PHP worker counts, PHP-FPM status and upstream timeouts. If your host cannot answer those questions, or the same problem returns every few weeks on a plan they say is adequate, that is useful information too — it tells you the plan, or the host, is no longer a fit. If the error followed a move between hosts, our guide to moving a WordPress site to a new host without downtime covers the DNS and CDN checks that prevent exactly this kind of timeout.

Frequently Asked Questions

What causes a 504 error in WordPress?

A 504 means a gateway or proxy waited too long for an upstream server to respond. In WordPress the usual causes are overloaded PHP workers, a hanging plugin or query, low server limits, database problems, or a CDN that cannot reach your origin server in time.

Is a 504 error my fault or my host’s fault?

It can be either. Plugin conflicts, heavy tasks, and outgrowing your plan are site-side causes, while server outages and misconfigured proxies are host-side. Following the checks in this guide helps you identify which side is responsible before contacting support.

Will a 504 error hurt my SEO?

A brief error lasting minutes rarely matters, but repeated or prolonged downtime can reduce crawling and rankings if search engines keep finding the site unavailable. Fix the root cause promptly and monitor uptime so short incidents do not become a pattern.

How do I stop 504 errors from coming back?

Keep plugins and themes updated, avoid resource-heavy tools during peak traffic, maintain adequate PHP workers and memory for your traffic level, and use uptime monitoring with alerts. If errors return under normal load, upgrading hosting is usually the lasting fix.

Why does the 504 only appear on one page?

A single-page 504 usually points at something specific to that page: a shortcode or widget running a slow query, a form or checkout process that takes too long, or a page builder element calling an external service. Test the page with plugins deactivated and check the error logs for the script that timed out on that URL.

Sarah Mitchell
Written by Sarah Mitchell

Sarah is a web hosting specialist with 8 years of experience running WordPress sites. She writes practical hosting and WordPress guides.

Similar Posts