When in doubt try flushing the cache, you'd be surprised how often this resolves issues. Welcome to WordPress ✌️
- HELP! My site is down!1!!11!!11
- Plugin is incompatible with OtherPlugin
- Status:
Not connected
connection timed out
andread error on connection
- How can I exclude a page from the cache?
- My site is getting redirected another domain
- Are transients stored in Redis?
- I'm getting
404
errors - WordPress is slower with Redis Object Cache enabled
NOAUTH Authentication required
Allowed memory size of 1337 bytes exhausted
OOM command not allowed
Flushing the cache causes timeout
- Unable to flush the cache
- Cache is flushed constantly
- Flushing the cache regularly
- How can I uninstall the cache?
The easiest way to to disable Redis on your site is deleting the wp-content/object-cache.php
drop-in file. Alternatively, you can set the WP_REDIS_DISABLED
constant to true
to bypass loading it.
Unfortunately many plugin authors don't bother testing their plugins with a persistent object cache. If you’re experiencing a compatibility issue with another plugin in combination with Redis Object Cache, please contact the support team of the other plugin regarding the issue.
This plugin is not the issue, it's just providing WordPress with wp_cache_*()
functions for persistent caching.
This means that either Redis Server is not installed and running, or the plugin is not configured correctly.
First, make sure you followed the installation instructions and that Redis Server is up and running:
redis-cli PING
# or specify a custom host/port
redis-cli -h 127.0.0.1 -p 6379 PING
If Redis Server is not installed and running, follow the installation instructions, or ask your hosting company for assistance.
Next, make sure confirm the wp-config.php
file contains the correct WP_REDIS_*
constants and configuration constants are defined high up in the wp-config.php
above the lines:
/* That's all, stop editing! Happy publishing. */
require_once(ABSPATH . 'wp-settings.php');
If you moved all constants above those lines and the plugin still shows Not Connected
, double check your connection options, or ask your hosting provider for assistance.
If the error occurs rarely, ignore it, Redis Server is having a hiccup. If it persists, read the answer to "Status: Not connected
".
Object caching caches only objects, not pages. You cannot exclude a page from using the object cache, because object caching is not URL-centric. You also cannot exclude the WordPress admin dashboard from using object caching, because then you risk the cache going stale and even loosing data.
If you’re experiencing a compatibility issue with another plugin in combination with Redis Object Cache, please contact the support team of the plugin regarding the issue and ask them to ensure it's compatible with persistent object cache backends, like Redis.
That happens when the same WP_REDIS_DATABASE
index is used for multiple WordPress installations. You MUST set a separate WP_REDIS_DATABASE
and WP_REDIS_PREFIX
for each domain to avoid data collision.
Once your site is being redirected, you MUST flush the entire Redis Server using the FLUSHALL
command to recover from this error:
redis-cli -h 127.0.01 -p 6379 FLUSHALL
Yes. The WordPress Transients API will use Redis to store transients and not the options
table.
After enabling Redis Object Cache, consider deleting all database transients:
wp transient delete-all
DELETE FROM `wp_options`
WHERE `option_name` LIKE '_transient_%'
OR `option_name` LIKE '_site_transient_%';
This may be an issue with WordPress 6.1's query caching feature, which you can disable by creating your own Must Use Plugin containing this snippet:
add_action( 'parse_query', function ( $wp_query ) {
$wp_query->query_vars[ 'cache_results' ] = false;
} );
This should never always means something is broken.
- Does the plugin show "Connected"?
- Is Redis Server responding too slowly? Run
redis-cli --latency-history
to find out. - Is Redis Server maxing out it's RAM or CPU?
You either need to add the WP_REDIS_PASSWORD
constant to your wp-config.php
file, or move the constant above higher up in your wp-config.php
file, above these lines:
/* That's all, stop editing! Happy publishing. */
require_once(ABSPATH . 'wp-settings.php');
This can happen when using a persistent object cache. Increase PHP's memory limit.
- https://wordpress.org/documentation/article/common-wordpress-errors/#allowed-memory-size-exhausted
- https://woocommerce.com/document/increasing-the-wordpress-memory-limit/
This can happen when Redis Server runs out of memory and no maxmemory-policy
was set in the redis.conf
.
Alternatively, you can set the WP_REDIS_MAXTTL
constant to something relatively low (like 3600
seconds) and flush the cache.
This can happen when the dataset in Redis Server is quite large. Consider increasing WP_REDIS_READ_TIMEOUT
and WP_REDIS_FLUSH_TIMEOUT
to 5-10 seconds.
Alternatively, starting with Redis 6.2, setting the lazyfree-lazy-user-flush
in the redis.conf
configuration directive to yes
changes the default flush mode to be asynchronous.
If your site is unreachable, you can flush the cache without access to the WordPress dashboard.
Try running wp cache flush
, or using redis-cli
directly:
redis-cli -h 127.0.01 -p 6379 FLUSHALL
Alternatively, you can use a desktop client like Medis or RedisInsight to connect to your Redis Server and flush it by executing FLUSHALL
.
If you don't see metrics building up, or your site is not getting faster, you might have an active plugin that flushes the object cache frequently. To diagnose this issue you can use the following snippet to find the source of the cache flush:
add_action( 'redis_object_cache_flush', function( $results ) {
ob_start();
echo date( 'c' ) . PHP_EOL;
var_dump( $results );
debug_print_backtrace();
error_log( ob_get_clean(), 3, ABSPATH . '/redis-cache-flush.log' );
}, 10, 5 );
Once you found the plugin responsible by checking redis-cache-flush.log
, you can contact the plugin author(s) and reporting the issue.
It's considered a bad practise to flush the frequently, but sometimes 3rd party plugins and themes just don't play nice with persistent object caches. When the plugin/theme authors refuse to fix their code you can use WP Cron to flush the Redis object cache frequently.
if ( ! wp_next_scheduled( 'flush_redis_cache' ) ) {
wp_schedule_event( time(), 'hourly', 'flush_redis_cache' );
}
add_action( 'flush_redis_cache', 'wp_cache_flush' );
Before uninstalling the plugin, be sure to disable the cache via WordPress -> Settings -> Redis
.
If you already removed the plugin before doing so, you can delete the object-cache.php
file in your /wp-content/
directly.