WordPress 504 Gateway Timeout: Find the Slow Layer

WordPress 504 Gateway Timeout? Check which timeout fires first with our free tool, using Cloudflare, Nginx and PHP defaults, then fix the slow task for good.

Share this post
7 min read

Last updated December 2, 2026

Your WordPress site shows “504 Gateway Timeout”. It often happens during an import, a big update or when saving a long post.

A 504 means a server waited for an answer and gave up. Somewhere in the chain, a timer ran out.

This guide finds which timer it was, then speeds up the task or moves it out of the way.

Key Takeaways

  • A 504 means the gateway got no reply in time from the server behind it, MDN says.
  • Each layer has a limit. The shortest one fails first.
  • Cloudflare waits 125 seconds by default, not the 100 many guides say.
  • Nginx waits 60 seconds by default for PHP, and PHP stops scripts after 30 seconds by default.
  • Long imports and backups should run in smaller batches or in the background.
Your site is safe. A timeout stops one request. Nothing is deleted, though a cut off import may need to run again.

Find Your Fix

Start with when the 504 appears. That points to the slow task.

504 fix finder

Answer two questions. The finder points to the slow task and the limit it hits. It runs in your browser only.

Digieh tool. Based on MDN, Cloudflare, nginx and PHP docs, read December 2, 2026.

What Does 504 Gateway Timeout Mean?

MDN’s 504 reference says the gateway or proxy did not get a response in time from the upstream server.

Unlike a 502, the server behind did not send a broken reply. It sent nothing before the timer ran out.

MDN adds that fixing a 504 often needs the server administrator. It can also be a client network problem, especially with a virtual private network app.

Which Timeout Fires First?

LayerDefault limitWhat happens when it runs out
Cloudflare proxy125 secondsCloudflare shows error 524
Nginx reading from PHP60 secondsNginx shows 504
PHP max_execution_time30 secondsPHP stops the script

Sources: Cloudflare 524 docs, nginx FastCGI docs and PHP manual, read December 2, 2026. Hosts often change these values.

Editor’s Note

This guide is accurate as of Digieh check. Cloudflare’s docs give 125 seconds, not 100. And with default settings, Nginx gives up at 60 seconds, long before Cloudflare does.

Spot an error in this article? Please contact us at support@digieh.com or read our Corrections Policy.

Check Your Timeout Chain

Enter the limits your host uses, or keep the defaults. Add how long your task takes to see which layer stops it.

Timeout chain checker

Each layer has its own time limit. The shortest one fails first. Defaults are filled in, so change them if your host uses other values.

Your result appears here.

Digieh tool. Runs in your browser only. Defaults from Cloudflare, nginx and PHP docs, read December 2, 2026.

125 sCloudflare’s default wait for your server. Only Enterprise plans can raise it. Source: Cloudflare docs.

When did your WordPress 504 happen?

  • During an import or backup
  • When saving a post
  • On normal pages
  • Only for some visitors
  • Not sure

Free updates

Join the Digieh list

Be the first to know when our weekly brief launches.

No spam. Unsubscribe anytime. Read our Privacy Policy.

How Do You Fix a 504 During Imports and Backups?

These tasks process a lot of data in one go. They are the most common cause of 504s.

  • Import in smaller files or batches.
  • Use a backup plugin that works in steps, not one long request.
  • Run heavy tasks with the command line if your host offers it. It has no web timeout.
  • Schedule big jobs at quiet times.

Cloudflare’s docs suggest a DNS-only subdomain for long requests, or a design that checks progress instead of waiting.

If an import stops part way, check what was saved before you run it again. Some importers skip items that already exist, and some create duplicates.

Always take a backup before a big import, so you can roll back if a timeout leaves things half done.

How Do You Fix a 504 When Saving Posts?

Some plugins do heavy work when you click Update. Search analysis, translation and cache warming are common.

  1. Note which plugins run on save.
  2. Rename the plugin you added last in wp-content, plugins.
  3. Save again and see if the 504 stops.
  4. Look for a setting that runs the task in the background instead.

Also check memory. A task that runs out of memory can stall. Our WordPress memory exhausted guide helps.

What If Normal Pages Show 504?

If simple pages time out, the database or server is struggling. That is rarely a single plugin.

  • Ask your host whether the database is slow or locked.
  • Check for traffic spikes or bot floods.
  • Use a page cache so most visits skip PHP.
  • Consider more server resources if traffic grew.

Seeing 502 instead? See our WordPress 502 Bad Gateway guide for the difference.

Why Does a 504 Happen Only Sometimes?

A task that takes 55 seconds on a quiet day may take 70 seconds when the server is busy. On a 60 second limit, that is the difference between working and failing.

  • Busy hours slow every request a little.
  • Other sites on shared hosting can use the same server.
  • A growing database makes the same task slower each month.

If 504s appear more often over time, the task or the data is growing. Plan to split it before it fails every time.

Keeping a simple log of when 504s happen helps you and your host spot the pattern.

How Do You Find the Slow Task?

A 504 tells you something was slow, but not what. These checks narrow it down.

  1. Note the exact page or action that times out.
  2. Try the same action with all plugins switched off, by renaming the plugins folder.
  3. Turn plugins back on one by one, testing each time.
  4. Ask your host for slow query and error logs for that time.

A query monitor plugin can show slow database queries on pages you can still open. Remove it when you finish, since it adds load.

Can Scheduled Tasks Cause 504s?

Yes. WordPress runs scheduled jobs, like backups and update checks, during normal page loads.

If a heavy job starts while someone visits, that visit can time out. Moving jobs to a server cron job avoids this.

Our WordPress missed schedule guide shows how to set up a server cron job step by step.

What Should You Tell Your Host?

  • The exact time of the 504 and your timezone.
  • The page or action, such as importing products.
  • How long the task usually takes when it works.
  • Whether Cloudflare or another proxy is in front of the site.

Ask which layer logged the timeout and what its limit is. That one answer often explains the whole problem.

Should You Just Raise Every Timeout?

Raising limits a little can help. Raising them a lot hides the real problem.

A page that takes two minutes is slow for visitors even if it no longer fails. Fix the slow work first.

On your own server, keep PHP max_execution_time below the web server timeout. Then PHP can stop and log the error before the proxy gives up.

The PHP manual notes one catch for Linux and other non Windows systems. There, time spent waiting on the database may not count toward this limit.

Try this today. Time your biggest admin task once. Knowing it takes 40 or 90 seconds tells you which limit to watch.

Test Yourself

What is Cloudflare’s default wait for your server, per its docs?

  1. 125 seconds
  2. 10 seconds
  3. 600 seconds

Cloudflare’s 524 docs say the default Proxy Read Timeout is 125 seconds.

With default settings, which layer gives up first on a 90 second PHP task?

  1. PHP at 30 seconds
  2. Cloudflare at 125 seconds
  3. None of them

PHP max_execution_time defaults to 30 seconds, the shortest of the three.

Frequently Asked Questions

Is a 504 Gateway Timeout my fault?

Usually it is a slow task on the server. Your connection rarely causes it.

Will a 504 fix itself?

Sometimes, if the server was briefly busy. Repeated 504s need a fix.

What is the difference between 504 and 524?

A 524 is Cloudflare’s name for the same timeout from your server.

Can I raise the Cloudflare timeout?

Cloudflare says only Enterprise plans can raise it.

Does a 504 break my import?

It can stop it part way. Run it again in smaller batches.

Conclusion

A 504 means a timer ran out before your server answered. Find the shortest limit in the chain. Then split long tasks, fix slow plugins or ask your host about the database. Raise limits only a little, and move very long jobs to the background.

Editor’s Note

This guide is accurate as of December 2, 2026. We checked MDN, Cloudflare, nginx and PHP documentation on that date.

Spot an error in this article? Please contact us at support@digieh.com or read our Corrections Policy.

Keep exploring

Your next read is waiting

Found this useful?

Share this post
Avatar photo

Syed Wasif Raza

Syed Wasif Raza is the founder and editor of Digieh. He writes about health, food, lifestyle, news and sports in plain, easy English. Every guide he publishes is checked against official sources such as government and health agency pages. Connect with him on LinkedIn.

Articles: 935

Leave a Reply

Your email address will not be published. Required fields are marked *