WordPress 504 Gateway Timeout: 7 Easy Ways to Fix It

Affiliate Disclosure: Some links on this page are affiliate links. If you purchase through our links, we may earn a commission at no extra cost to you.

Last updated: December 4, 2026 · Reading time: about 10 minutes

A WordPress 504 gateway timeout means a server in front of your site waited too long for WordPress to answer and gave up. To fix it, wait a minute and reload, then deactivate plugins, raise the PHP and server timeouts, turn off any CDN for a test, and ask your host if the server is overloaded.

Key takeaways

  • A 504 is not a WordPress bug message. It comes from a gateway or proxy such as Nginx, a load balancer or a CDN.
  • The cause is almost always something slow: a heavy plugin, a slow database query, an overloaded server or a very short timeout.
  • If it hits only one page or action, suspect a plugin or a large task. If it hits every page, suspect the server.
  • Raising a timeout hides the problem. Find what is slow, then raise the timeout only if the task really needs it.
  • Your host can read the server logs. Send them the exact time of the error.
WordPress 504 gateway timeout flow from visitor request to timeout
The gateway, not WordPress, shows the error.

What is a WordPress 504 gateway timeout?

It is the HTTP status code 504. A gateway or proxy sent your visitor’s request on to another server, and that server did not reply in time. On WordPress hosting the gateway is usually Nginx or a CDN and the slow server is PHP running WordPress.

The MDN documentation describes 504 Gateway Timeout as the server acting as a gateway not getting a response in time from the server it needed. The wording on your screen changes with the host: “504 Gateway Time-out”, “Gateway Timeout” or “The server didn’t respond in time”.

How is a 504 different from a 502 or a 500?

A 500 means the site itself broke. A 502 means the gateway got a bad reply. A 504 means it got no reply in time. The fixes overlap, but a 504 points at slowness rather than a crash.

Why does the WordPress 504 gateway timeout happen?

The usual causes are an overloaded server, a plugin or theme that runs slowly, a heavy database query, a long task such as an import or backup, a timeout set too low, and a CDN or firewall that cannot reach your origin server.

An overloaded server

On shared hosting, many sites share the same processes. A traffic spike or a bot crawl can leave every PHP worker busy, so new requests wait until the gateway gives up.

A slow plugin or theme

Plugins that call outside services, scan files or build big pages can take longer than the gateway allows. A broken license check that waits on a remote server is a common example.

Long tasks in the dashboard

Imports, bulk edits, backups and large updates can run for minutes. The browser waits on one request while the gateway cuts it off.

Timeouts that are too short

Each layer has its own limit. PHP has max_execution_time. Nginx has settings such as fastcgi_read_timeout. A CDN has its own. The shortest one that is reached first decides when you see the error.

A CDN or firewall problem

If a CDN cannot reach your origin, or your firewall blocks the CDN’s addresses, the CDN reports a timeout even though the site is fine when you open it directly.

Table of common causes of a WordPress 504 gateway timeout
Match the sign to the first check.

How do you fix a WordPress 504 gateway timeout?

Work from the quickest check to the deepest. Reload, check the host status, test with plugins off, then look at timeouts and the CDN. Change one thing at a time and test after each step.

  1. Wait a minute and reload. A short spike often clears by itself.
  2. Check whether the whole site is affected. Try the home page, a second page and wp-admin. One failing page points at that page’s content or plugin.
  3. Check your host’s status page. An outage or maintenance window on the server explains the error.
  4. Back up, then deactivate all plugins. If you cannot open the dashboard, rename the wp-content/plugins folder through the file manager or SFTP. If the site loads, reactivate plugins one by one.
  5. Switch to a default theme such as Twenty Twenty-Four to rule the theme out.
  6. Raise the PHP time limit. In your hosting panel, set max_execution_time to 120 seconds for a heavy task. Our backup guide is a good first step before you change settings.
  7. Turn off the CDN for a test. Pause the CDN or point the test at the origin. If the error goes away, check the CDN’s origin settings and firewall rules.

If the error is on one page only

Open that page in the editor and look for heavy blocks, embeds and shortcodes. Remove them one at a time and save. A page that loads hundreds of products or a slow external feed is a typical cause.

If the error appears during an import or backup

Split the job into smaller parts or run it with a plugin that works in batches. A long single request will always hit a gateway limit.

Steps to fix a WordPress 504 gateway timeout in order
Change one thing at a time.

Where are the timeouts set?

Three layers can end a request: PHP, the web server or gateway, and a CDN or proxy. On most shared hosts you change PHP in the hosting panel and the rest through support.

The Nginx documentation lists fastcgi_read_timeout with a default of 60 seconds. The PHP manual lists max_execution_time with a default of 30 seconds for web requests. Your host may use other values, so check your own panel rather than assuming these.

Table of where WordPress 504 gateway timeout limits are set
The shortest limit reached first decides.

How do you find what is slow?

Repeat the failing action with plugins off, read the server error log for the time of the error, and check your database and traffic. The slow part is rarely random.

  • Note the exact time and page of the error. Your host can match it to its logs.
  • Look at the PHP error log for warnings near that time.
  • Check for a traffic spike or a crawler in your hosting analytics.
  • Read our guide on speeding up a WordPress site for caching and image tips that cut server work.
  • If the dashboard fails too, compare with the white screen of death steps, which share several checks.
Checklist to find what causes a WordPress 504 gateway timeout
The slow part is rarely random.

When should you contact your host?

Contact your host if the error stays with all plugins off, if it hits every page, or if it comes and goes during busy hours. They can see worker limits, server load and logs that you cannot. Send the time of the error, the URL and what you already tried. Related errors are covered in our guide to sites stuck in maintenance mode and the memory exhausted error.

How do you prevent a WordPress 504 gateway timeout?

  • Use page caching so visitors do not trigger PHP on every request.
  • Keep plugins few and updated. Remove ones you do not use.
  • Run long jobs outside peak hours and in batches.
  • Follow the steps in WordPress security basics to block bad bots that waste server time.
  • Upgrade the plan if traffic has outgrown it.

Frequently asked questions

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

It can be either. A heavy plugin is on your side. An overloaded server is on your host’s side. Testing with plugins off tells you which.

Will a 504 hurt my SEO?

A short outage is usually fine. Long or repeated errors can make search engines crawl less. Fix recurring errors quickly.

Does clearing the cache fix a 504?

Only if a bad cached response is involved. Clear it as a quick test, but a real timeout needs the slow part fixed.

What is the difference between 504 and 524?

524 is a Cloudflare status for the same idea: the CDN connected to your server but got no reply in time. Check your origin the same way.

Can I fix a 504 without dashboard access?

Yes. Use the file manager or SFTP to rename the plugins folder, or edit settings in your hosting panel.

How long should I wait before I act?

Wait one to two minutes. If the error stays, start with plugins and the host status page.

Should I raise every timeout to the maximum?

No. Very long timeouts tie up server workers and can make an overload worse. Raise them only for tasks that truly need it.

Sources and further reading

Summary

A 504 means something was too slow. Check the host, test with plugins and theme off, look at the timeouts and the CDN, and find the slow task before you raise any limit. Back up first and change one thing at a time.

About the author: Mo Abdlhamid works on websites and online business in Egypt and writes the guides on CMS Ideas. This guide is based on the MDN, Nginx and PHP documentation linked above. We did not run a timed test on every host for it. Last reviewed December 4, 2026.

Leave a Comment