Title: WP_Object_Cache::flush
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Object_Cache::flush(): true

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/WP_Object_Cache/flush/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/WP_Object_Cache/flush/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/WP_Object_Cache/flush/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/WP_Object_Cache/flush/?output_format=md#changelog)

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

Clears the object cache of all data.

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

 true Always returns true.

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

    ```php
    public function flush() {
    	$this->cache = array();

    	return true;
    }
    ```

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

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

| Used by | Description | 
| [wp_cache_flush()](https://developer.wordpress.org/reference/functions/wp_cache_flush/)`wp-includes/cache.php` |

Removes all cache items.

  |

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

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

## User Contributed Notes

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