A WordPress 504 Gateway Timeout error means a gateway, proxy, CDN, or web server waited for another server to respond but did not receive the response within the allowed time.
You may see “504 Gateway Timeout”, “Gateway Timeout,” “HTTP Error 504,” or a CDN-branded timeout page instead of your WordPress website.
The problem often appears during slow PHP requests, large database operations, plugin background jobs, backups, imports, WooCommerce processes, traffic spikes, or overloaded hosting.
Unlike a normal 404 error, the page may exist and WordPress may still be installed correctly. The request is simply taking too long somewhere in the server chain.
QUICK ANSWER
If WordPress shows a 504 Gateway Timeout error, first confirm whether the problem affects the whole site or only one action. Clear caches, temporarily disable recently changed plugins, check PHP workers and hosting resources, test the active theme, review Cloudflare or proxy settings, inspect slow database or background processes, and check server logs. If the timeout continues across the entire website, ask your host to inspect PHP-FPM, upstream response times, database load, and proxy timeout logs.
What Does 504 Gateway Timeout Mean in WordPress?
A WordPress request may pass through several systems before the visitor receives a page.
A simplified request path may look like:
Visitor
↓
Cloudflare / CDN / Reverse Proxy
↓
Web Server
↓
PHP-FPM
↓
WordPress
↓
Database
If one system waits too long for the next system in the chain, the gateway may stop waiting and return a 504 response.
This means the error may originate from:
- a CDN,
- reverse proxy,
- Nginx or Apache,
- PHP-FPM,
- the database server,
- or a WordPress process that is taking too long.
The key to troubleshooting is finding which request or server process is slow.
1. Check Whether the Error Affects the Whole Site
Start by identifying the scope of the timeout.
Test:
- your homepage,
- a normal blog post,
/wp-login.php,/wp-admin/,- and the specific page or action that triggered the error.
Also try another browser and your phone using mobile data.
If every URL returns 504, investigate the hosting server, CDN, proxy, PHP workers, and database first.
If only one page or admin action produces the timeout, focus on what that request is doing.
For example, a timeout that occurs only while:
- creating a backup,
- importing products,
- saving a page-builder layout,
- running a malware scan,
- or generating thousands of thumbnails
strongly suggests that the operation itself is exceeding available server resources or execution time.
2. Clear WordPress, Hosting, and CDN Caches
Clear all caching layers before making major configuration changes.
This may include:
- WordPress caching plugins,
- LiteSpeed Cache,
- object cache,
- hosting-level cache,
- Nginx or Varnish cache,
- Cloudflare or another CDN,
- and your browser cache.
After clearing the caches, open the site in a private browser window and test again.
If the timeout disappeared after a temporary server problem, an old cached error page may have been contributing to what you were seeing.
If the 504 immediately returns, continue troubleshooting the actual server response time.
3. Temporarily Disable Recently Changed Plugins
A WordPress plugin can create a request that takes too long to complete.
Plugins worth investigating include:
- backup plugins,
- security scanners,
- WooCommerce extensions,
- page builders,
- database optimization tools,
- image optimization plugins,
- SEO crawlers,
- import/export plugins,
- and plugins performing external API requests.
If the 504 began immediately after installing or updating a plugin, temporarily deactivate that plugin first.
Then repeat the request that previously timed out.
If You Cannot Access wp-admin
Open your hosting file manager or connect with FTP/SFTP.
Navigate to:
/wp-content/
Temporarily rename:
plugins
to:
plugins-disabled
Reload your website.
If the site returns immediately, restore the folder name and test individual plugins until you identify the slow or failing component.
Do not permanently disable every plugin. This test is only meant to isolate the source of the timeout.
4. Check PHP Memory, Workers, and Execution Resources
WordPress relies on PHP processes to generate dynamic pages.
If PHP workers are occupied or a request requires too many resources, the proxy or web server may wait until its timeout limit is reached.
Open your hosting resource dashboard and check:
- CPU usage,
- RAM usage,
- PHP memory,
- PHP workers,
- entry processes,
- database connections,
- execution time,
- and account resource limits.
Look for spikes at the same time the 504 error occurred.
Heavy background jobs can consume multiple PHP workers and leave none available for normal visitor requests.
If your logs show:
Allowed memory size exhausted
see our WordPress Memory Exhausted Error? 7 Fixes guide.
If the server instead reports that the service is temporarily unavailable, see our WordPress 503 Service Unavailable? 8 Fixes guide.
5. Test the Active WordPress Theme
A theme can also generate unusually slow requests.
This can happen because of:
- inefficient custom PHP,
- large database queries,
- external API calls,
- page-builder functions,
- or recently added code in
functions.php.
If you can access wp-admin, temporarily activate a standard lightweight WordPress theme.
Then test the same page again.
If the timeout disappears, investigate:
- recent theme updates,
- child-theme modifications,
- custom functions,
- template queries,
- and theme integrations.
Do not permanently switch themes until you have confirmed that the active theme is actually responsible.
6. Check Cloudflare, CDN, and Reverse Proxy Settings
A 504 error is often displayed by a gateway or proxy rather than WordPress itself.
If your site uses Cloudflare, another CDN, or a reverse proxy, check:
- origin server availability,
- proxy status,
- firewall events,
- rate limiting,
- SSL/TLS configuration,
- DNS records,
- and upstream response times.
If the CDN can connect to your origin but the origin takes too long to respond, the CDN may stop waiting and return a timeout page.
Check whether the problem began after:
- enabling a proxy,
- changing Cloudflare settings,
- moving hosts,
- changing DNS,
- or modifying SSL settings.
Do not simply increase every timeout value without understanding why the origin is slow.
A longer timeout can hide a performance problem instead of fixing it.
7. Check Slow Database Queries and Background Jobs
WordPress may appear to be waiting on PHP when PHP is actually waiting for the database.
Database-related causes can include:
- very large WordPress options tables,
- inefficient plugin queries,
- large WooCommerce databases,
- database locks,
- large postmeta tables,
- scheduled cleanup jobs,
- imports,
- and overloaded MySQL or MariaDB servers.
Pay attention if the timeout occurs only during:
- WordPress admin searches,
- WooCommerce reports,
- large product edits,
- bulk updates,
- or plugin database maintenance.
If you have access to hosting database metrics, check:
- database CPU,
- slow queries,
- connection limits,
- and long-running processes.
If the entire website instead displays “Error establishing a database connection”, troubleshoot the database connection itself rather than treating it as a gateway timeout.
8. Check Server Logs and Ask Your Host to Trace the Timeout
If the cause is still unclear, server logs are the most important next step.
Check:
- PHP error logs,
- PHP-FPM logs,
- Nginx logs,
- Apache logs,
- database logs,
- WordPress debug logs,
- hosting resource logs,
- and CDN events.
Reproduce the error once and note the exact time.
Then look for messages around that timestamp.
Useful clues include:
- upstream timed out,
- PHP worker exhaustion,
- maximum execution time exceeded,
- database query timeouts,
- process termination,
- memory exhaustion,
- and slow external HTTP requests.
If you contact your host, provide:
- the exact 504 message,
- the affected URL,
- the approximate time,
- the action you were performing,
- whether the problem is intermittent,
- and whether wp-admin is also affected.
Ask them to check:
- PHP-FPM response times,
- PHP workers,
- proxy or upstream timeout logs,
- database load,
- CPU and RAM limits,
- and long-running PHP processes.
504 Gateway Timeout vs 502 Bad Gateway
These errors are closely related, but they are not the same.
502 Bad Gateway usually means the gateway received an invalid response from the upstream server.
504 Gateway Timeout means the gateway did not receive the necessary upstream response within the required amount of time.
If your browser specifically displays 502, see our WordPress 502 Bad Gateway? 8 Fixes guide.
504 Gateway Timeout vs 503 Service Unavailable
A 503 Service Unavailable generally means the service is temporarily unable to process the request.
A 504 Gateway Timeout means a gateway or proxy waited too long for an upstream response.
Both can result from overloaded hosting resources, but the status code helps identify where to start.
504 Gateway Timeout vs cURL Error 28
Both errors involve waiting too long, but they occur in different contexts.
504 Gateway Timeout is an HTTP response normally returned to the client by a gateway or proxy.
cURL error 28 appears when a WordPress or PHP HTTP request itself exceeds its configured timeout.
If Site Health or a plugin specifically reports cURL error 28, see our WordPress cURL Error 28? 8 Fixes guide.
Why Does 504 Happen Only During Backups or Imports?
Backups and imports can be much heavier than normal page requests.
They may require:
- large database reads,
- file compression,
- remote uploads,
- image processing,
- or thousands of database writes.
If the site works normally except during one large job, the solution may be to reduce the size of the operation.
For example:
- split a large import into smaller batches,
- exclude unnecessary files from backups,
- run jobs during lower-traffic periods,
- or use a background process designed for long-running tasks.
Increasing a proxy timeout should not be the first response to an inefficient task.
Why Does WordPress 504 Happen at the Same Time Every Day?
A repeating schedule is an important clue.
Look for:
- scheduled backups,
- malware scans,
- WP-Cron jobs,
- WooCommerce scheduled actions,
- database optimization,
- external feeds,
- and server maintenance.
If the error begins at almost exactly the same time each day, compare that time with your scheduled jobs.
If WP-Cron itself is behaving incorrectly, see our WordPress Cron Not Working? 8 Fixes guide.
Can High Traffic Cause a 504 Gateway Timeout?
Yes.
A traffic spike can exhaust:
- PHP workers,
- CPU,
- RAM,
- database connections,
- and server process capacity.
However, check whether the traffic consists of real visitors or automated requests.
Review:
- analytics,
- access logs,
- bot traffic,
- login attempts,
- REST API traffic,
- XML-RPC requests,
- and repeated requests to expensive URLs.
Reducing unnecessary traffic or caching expensive pages can sometimes solve recurring timeouts without immediately upgrading the hosting plan.
Should You Increase PHP max_execution_time?
Sometimes, but not automatically.
If a legitimate process requires slightly more time, increasing the execution limit may help.
But a normal page taking several minutes to load is a performance problem, not simply a timeout-setting problem.
Before increasing limits, investigate:
- plugin conflicts,
- slow database queries,
- external API requests,
- PHP worker availability,
- and hosting resource usage.
Ask your host about the maximum allowed execution time and proxy timeout before changing server configuration.
Can a 504 Error Hurt SEO?
A brief temporary outage is different from permanently deleting a page.
However, repeated or long-lasting gateway timeouts can prevent search engines from reliably accessing your content.
After fixing the problem:
- test important pages,
- test the homepage,
- check Google Search Console if necessary,
- and make sure the URLs return normal responses again.
If the website works but important pages still are not appearing in Google, see our Website Not Showing on Google? 11 Fixes guide.
Final Checklist
If WordPress shows a 504 Gateway Timeout error, work through these steps:
- Determine whether the entire site or one request is affected.
- Clear WordPress, hosting, browser, and CDN caches.
- Temporarily disable recently changed plugins.
- Check PHP workers, memory, CPU, and execution resources.
- Test the active WordPress theme.
- Review CDN and reverse-proxy configuration.
- Investigate slow database queries and background jobs.
- Review server logs and ask your host to trace the timeout.
The best fix is not simply to make the server wait longer. Identify why the upstream response is slow. Once you know whether PHP, the database, a plugin, an external API, or the hosting platform is responsible, you can correct the underlying cause instead of hiding it with a larger timeout.