Home / WordPress / WordPress 504 Gateway Timeout: Fix

WordPress 504 Gateway Timeout: Fix

Fix 504 timeouts by identifying slow requests, increasing timeouts where possible, and optimizing plugins/database.

Views: 24 Unique: 18 Updated: 2026-03-20

What this problem is

The server/proxy returns 504 Gateway Timeout, often intermittently.

Why it happens

  • Slow PHP execution (heavy plugin/theme code)
  • Slow database queries
  • Upstream timeouts on proxy/CDN/load balancer

Prerequisites

  • Hosting panel access
  • Access to slow logs (PHP/MySQL) if available

Diagnosis

Identify which URL/action triggers the 504 (checkout, search, admin actions). Review slow logs.

Detailed steps

Step 1) Bypass cache and test

Determine if cache/proxy is involved by testing origin directly if possible.

Step 2) Disable heavy plugins temporarily

Disable plugins one by one and retest the slow endpoint.

Step 3) Optimize database and queries

Clean autoloaded options and optimize tables if needed.

Step 4) Increase timeouts (host-level)

Ask hosting to adjust proxy/PHP-FPM timeouts if justified.

Expected results

  • 504 stops and slow requests become responsive

What to do if it fails

  • Scale hosting resources or move to a plan suited for the workload

Best practices

  • Monitor slow queries and use caching for expensive pages
Back to category