wp_suspend_cache_invalidation() WP 2.7.0
Suspend cache invalidation.
Turns cache invalidation on and off. Useful during imports where you don't want to do invalidations every time a post is inserted. Callers must be sure that what they are doing won't lead to an inconsistent cache when invalidation is suspended.
No Hooks.
Return
true|false
. The current suspend setting.
Usage
wp_suspend_cache_invalidation( $suspend );
- $suspend(true|false)
- Whether to suspend or enable cache invalidation.
Default: true
Notes
- Global. true|false. $_wp_suspend_cache_invalidation
Changelog
Since 2.7.0 | Introduced. |
Code of wp_suspend_cache_invalidation() wp suspend cache invalidation WP 5.7
function wp_suspend_cache_invalidation( $suspend = true ) {
global $_wp_suspend_cache_invalidation;
$current_suspend = $_wp_suspend_cache_invalidation;
$_wp_suspend_cache_invalidation = $suspend;
return $current_suspend;
}