Does Redis Work With WordPress?
Redis integrates seamlessly with WordPress as a caching layer and session store, dramatically improving performance with minimal configuration.
Quick Facts
How Redis Works With WordPress
Redis works excellently with WordPress through PHP extensions and dedicated plugins like Redis Object Cache or WP Redis. WordPress connects to Redis via the `wp-redis` or `redis-cache` plugins, which hook into WordPress's internal object caching system to store frequently accessed data (posts, taxonomies, user metadata) in Redis instead of the database. This reduces database queries dramatically and decreases page load times by 40-60% on typical sites. The integration is transparent—WordPress doesn't need code changes; the plugin intercepts cache calls and routes them to Redis. For session management, plugins like Cachify or Breeze extend Redis support further. Most WordPress hosting providers (WP Engine, Kinsta, Pantheon) offer managed Redis, making deployment straightforward. The main architecture consideration is ensuring your Redis instance is reliably available; a crash falls back to database caching gracefully on properly configured installations. Development experience is excellent—install the plugin, configure the Redis host/port, and watch performance metrics improve immediately.
Best Use Cases
WordPress Redis Cache Configuration
composer require predis/predis<?php
// Add to wp-config.php before 'That's all, stop editing!'
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_PASSWORD', 'your-redis-password');
define('WP_REDIS_TIMEOUT', 1);
define('WP_REDIS_READ_TIMEOUT', 1);
define('WP_REDIS_MAXTTL', 2592000); // 30 days
define('WP_CACHE_KEY_SALT', 'mysite_');
define('WP_CACHE', true);
// Load the Redis cache plugin
require_once( WP_CONTENT_DIR . '/plugins/redis-cache/includes/plugin.php' );
// Optional: Enable persistent connections for lower overhead
define('WP_REDIS_PERSISTENT', true);
?>Known Issues & Gotchas
Cache invalidation issues when Redis is unavailable—stale data persists longer than expected
Fix: Set reasonable TTLs (time-to-live) on cached objects and monitor Redis uptime; most plugins gracefully degrade to database caching
Plugin conflicts when multiple cache plugins (Redis Object Cache, W3 Total Cache, WP Super Cache) fight for control
Fix: Use only one dedicated Redis plugin; disable other cache plugins completely to avoid race conditions
Memory exhaustion if Redis isn't sized correctly for your WordPress data volume
Fix: Monitor Redis memory usage with redis-cli INFO memory and configure eviction policies (allkeys-lru) or increase allocated memory
Serialization incompatibilities when upgrading PHP versions or changing serializers (igbinary vs PHP native)
Fix: Flush Redis cache after major version upgrades with redis-cli FLUSHALL
Alternatives
- •Memcached + WordPress (simpler but less feature-rich; lacks pub/sub and streams)
- •WordPress with WP-Rocket or Cloudflare (full-page HTML caching alternative to object caching)
- •Elasticsearch + WordPress for high-volume search queries instead of database searches
Resources
Related Compatibility Guides
Explore more compatibility guides