Skip to content

Flush the object cache

The object cache can be flushed with the WP-CLI command wp cache flush. WP-CLI commands must be run with VIP-CLI.

Caution

Use caution when flushing the object cache on a production environment. The performance of a site’s origin database server is protected by the object cache layer. Flushing the object cache can have negative performance implications, particularly during high traffic events.

Prerequisites

VIP-CLI is installed and has been updated to the most current version.

Limitations

Group cache flush with the wp_cache_flush_group() function or the wp cache flush-group WP-CLI command is not supported for WordPress environments on the VIP Platform.

Command examples

VIP-CLI command examples

For demonstration purposes, the <app-name> value example-app and the <env> value production are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.

For WordPress single sites, the object cache can be flushed with the WP-CLI command wp cache flush:

vip @example-app.production -- wp cache flush

For WordPress multisite environments, a specific network site must be targeted with the --url parameter in order for wp cache flush to successfully flush the object cache for that site.

vip @example-app.production -- wp cache flush --url=example.com

Note

When the WP-CLI command wp cache flush is run, a Warning message is returned that reads: Flushing the cache may affect all sites in a multisite installation. On VIP Platform environments, only the object cache for a network site that is targeted with the --url option will be flushed. If wp cache flush is run against a multisite environment without the --url parameter, only the object cache of the main site (ID 1) will be flushed.

Flushing the object cache after a domain change

On a WordPress multisite, to fully flush persistent objects from the object cache multiple wp cache flush commands might need to be run.

For example, after a site launch or a domain change, the wp cache flush command may need to be run for both the previous convenience domain value (e.g. example-app.go-vip.net) and the launched custom domain value (e.g. www.example.com):

$ vip @example-app.production -- wp cache flush --url=example-app.go-vip.net
Warning: Flushing the cache may affect all sites in a multisite installation, depending on the implementation of the object cache.
Success: The cache was flushed.

$ vip @example-app.production -- wp cache flush --url=www.example.com
Warning: Flushing the cache may affect all sites in a multisite installation, depending on the implementation of the object cache.
Success: The cache was flushed.

Last updated: December 10, 2025

Relevant to

  • WordPress