wp-content » plugins » Redis connection down? Stop the “Error Establishing a Redis Connection” crash on WordPress

Redis connection down? Stop the “Error Establishing a Redis Connection” crash on WordPress

If you’re running the Redis Object Cache plugin on a client site, you’ve probably seen this ugly white-screen error at some point:

Error establishing a Redis connection

To disable Redis, delete the object-cache.php file in the /wp-content/ directory.

2026 09 03 12 41 - Redis connection down? Stop the

By default, if Redis becomes unreachable (server restart, memory limit hit, network hiccup, provider maintenance..) the plugin throws a fatal error and takes your entire site down with it. Not great for a caching layer that’s supposed to make things faster, not riskier.

The One-Line Fix

Add this to wp-config.php:

define( 'WP_REDIS_GRACEFUL', true );

That’s it. With this constant set, if Redis goes down, WordPress doesn’t throw a fatal error – it just silently stops using Redis for that request and falls back to WordPress’s built-in in-memory (non-persistent) cache instead. Your site stays up. Visitors never see an error page. You get a clean entry in your PHP error log instead of an outage.


How does it actually work under the hood

See also  How to Reset WordPress Password from phpMyAdmin Database

Every time a Redis operation fails, the plugin calls an internal handle_exception() method. Without WP_REDIS_GRACEFUL, that method dies with wp_die() and shows the error screen above. With it enabled, the plugin instead:

  • Marks Redis as disconnected for the current request
  • Falls back all cache groups to the non-persistent, in-request cache
  • Logs the exception quietly via error_log()
  • Lets the page render normally

Worth knowing: this fallback resets on every request. It’s not a sticky “Redis is down, stop trying for 5 minutes” circuit breaker: WordPress will attempt to reconnect on the next page load too. If Redis is down for an extended period, every request pays a small connection-timeout cost before falling back. Keeping WP_REDIS_TIMEOUT and WP_REDIS_READ_TIMEOUT low (the plugin defaults to 1 second) keeps that cost negligible.

My standard practice

I add WP_REDIS_GRACEFUL to every client site where we set up Redis object caching. It costs nothing, and it’s the difference between “Redis had a bad five minutes” and “the site was down for five minutes.” If you want to get alerted when it kicks in rather than just checking logs, hook into redis_object_cache_error and fire off a Slack or email notification.

TL;DR: one constant, zero downside, add it every time.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended