Skip to content

Purge the page cache

By default, the VIP Platform caches responses from WordPress and Node.js applications by resource URL. Subsequent requests for the same resource URL may receive a previously cached response. The cached content can be purged on demand with VIP-CLI, a WordPress site’s admin dashboard, or the Cache API.



The cache purge-url command can purge any URLs hosted by a site, including:

  • posts and pages
  • REST API endpoints
  • static assets such as images, CSS, and JS files

The page cache for one or more URLs sharing the same domain can be purged with the VIP-CLI command:

vip @<app>.<env> cache purge-url <url> <url>

If multiple URLs are passed in the command, they must be separated by a single space.

VIP-CLI command examples

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

In this command example, two URLs hosted on the develop environment of the “mytestsite” application are purged in a single VIP-CLI command:

$ vip @mytestsite.develop cache purge-url
- Purged URL:
- Purged URL:


Accepted values: A relative or absolute path to a UTF-8-encoded text file

The --from-file option extracts a string from the file existing at the relative or absolute path in the passed value.

Use of the --from-file option is required for a string that has multiple lines created by return values.

In this example command, a list of URLs contained in the multiline contents of a *.txt file named url-purge-list.txt is passed to the vip cache purge-url to purge:

vip @mytestsite.develop cache purge-url --from-file=/path/to/url-purge-list.txt

WordPress Admin cache manager

Any logged in user with a role that has the manage_options capability (usually Administrator, or Super Admin) has access to the “Purge Cache For Page” button located in the WordPress Admin tool bar.

The “Purge Cache for Page” option only appears on a site’s front end view when a user is logged in.

Screenshot of “Purge Cache For Page” button as it appears in the WordPress Admin tool bar

Selecting “Purge Cache for Page” purges the cache for the page being viewed, as well as all file assets referenced by the page (e.g., images, CSS files, JS files).

Example screenshot of the confirmation message that appears in the WordPress Admin tool bar after purging the page cache

Cache manager filter

vip_cache_manager_can_purge_cache returns a boolean whether current user can have access to the “Purge Cache for Page” option based on a capability check. Defaults to current_user_can( 'manage_options' ).

The following code example will enable access to the “Purge Cache for Page” option for user roles with the edit_others_posts capability (usually Editor and greater):

// Allow editors and up to be able to purge a page from cache
add_filter( 'vip_cache_manager_can_purge_cache', function( $can_purge, $user ) { 
    return current_user_can( 'edit_others_posts' );
}, 10, 2 );

Cache API

Other page cache clearing methods using the cache API can be added to an application’s codebase.

Last updated: June 27, 2022