Disable Object Cache Addition/Invalidation in WordPress

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

You can temporarily disable object caching in WordPress‬ by calling:

wp_suspend_cache_addition( true );

Ref. You can turn addition back on by passing false as the only argument. There’s a similar approach for object cache invalidation. However, there’s a big chance persistent object caching plugins won’t implement these functions like WordPress built-in object caching does, so they might be unreliable if working in an unknown environment.

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.