On this page
wp_suspend_cache_addition( bool $suspend = null ): bool
Temporarily suspends cache additions.
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
$suspendbool Optional-
Suspends additions if true, re-enables them if false.
Default:
null
Return
bool The current suspend setting
Source
File: wp-includes/functions.php. View all references
function wp_suspend_cache_addition( $suspend = null ) {
static $_suspend = false;
if ( is_bool( $suspend ) ) {
$_suspend = $suspend;
}
return $_suspend;
}
Related
Used By
| Used By | Description |
|---|---|
| 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() wp-includes/class-wp-widget.php | Generates the actual widget content (Do NOT override). |
| WP_Widget::update_callback() wp-includes/class-wp-widget.php | Handles changed settings (Do NOT override). |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_suspend_cache_addition