wp_suspend_cache_invalidation

Suspend cache invalidation.

Description

wp_suspend_cache_invalidation( (bool) $suspend = true ); 

Turns cache invalidation on and off. Useful during imports where you don't wont 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.

Parameters (1)

0. $suspend — Optional. (bool) => true
Whether to suspend or enable cache invalidation. Default true.

Usage

  1. if ( !function_exists( 'wp_suspend_cache_invalidation' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // Optional. Whether to suspend or enable cache invalidation. Default true. 
  5. $suspend = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_suspend_cache_invalidation($suspend); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function wp_suspend_cache_invalidation( $suspend = true ) { 
  2. global $_wp_suspend_cache_invalidation; 
  3.  
  4. $current_suspend = $_wp_suspend_cache_invalidation; 
  5. $_wp_suspend_cache_invalidation = $suspend; 
  6. return $current_suspend;