Title: wp_suspend_cache_addition
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_suspend_cache_addition( bool $suspend = null ): bool

## In this article

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

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

Temporarily suspends cache additions.

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

Stops more data being added to the cache, but still allows cache retrieval.
This
is useful for actions, such as imports, when a lot of data would otherwise be almost
uselessly added to the cache.

Suspension lasts for a single page load at most. Remember to call this function 
again if you wish to re-enable cache adds earlier.

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

 `$suspend`booloptional

Suspends additions if true, re-enables them if false.
 Defaults to not changing 
the current setting.

Default:`null`

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

 bool The current suspend setting.

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

    ```php
    function wp_suspend_cache_addition( $suspend = null ) {
    	static $_suspend = false;

    	if ( is_bool( $suspend ) ) {
    		$_suspend = $suspend;
    	}

    	return $_suspend;
    }
    ```

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

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_suspend_cache_addition/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Object_Cache::add()](https://developer.wordpress.org/reference/classes/wp_object_cache/add/)`wp-includes/class-wp-object-cache.php` |

Adds data to the cache if it doesn’t already exist.

  | 
| [WP_Widget::display_callback()](https://developer.wordpress.org/reference/classes/wp_widget/display_callback/)`wp-includes/class-wp-widget.php` |

Generates the actual widget content (Do NOT override).

  | 
| [WP_Widget::update_callback()](https://developer.wordpress.org/reference/classes/wp_widget/update_callback/)`wp-includes/class-wp-widget.php` |

Handles changed settings (Do NOT override).

  |

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

| Version | Description | 
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.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_addition%2F)
before being able to contribute a note or feedback.