Title: wp_suspend_cache_invalidation
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_suspend_cache_invalidation( bool $suspend = true ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#wp--skip-link--target)

Suspends cache invalidation.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#description)󠁿

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.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#parameters)󠁿

 `$suspend`booloptional

Whether to suspend or enable cache invalidation.

Default:`true`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#return)󠁿

 bool The current suspend setting.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L6390)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L6390-L6396)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_suspend_cache_invalidation/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_suspend_cache_invalidation%2F)
before being able to contribute a note or feedback.