Skip to main content
Last Reviewed: 2022-10-06

Pantheon Commands for WP-CLI

Special commands to interact with Pantheon via WP-CLI


This section provides information on how to run Pantheon-specific commands on WP-CLI.

Toggle Maintenance Mode

To enable Maintenance Mode while serving cached pages to visitors, use the command wp pantheon cache set-maintenance-mode MODE and replace MODE with one of the following options:

  • anonymous: Serve cached pages to visitors and bots.
  • everyone: Serve cached pages to all visitors except administrators.
  • disabled: Disable Maintenance Mode and return to normal operation.

For example, to disable Maintenance Mode:

Control Cache With The Pantheon Advanced Page Cache Plugin

Install and activate the Pantheon Advanced Page Cache plugin to manage the page cache from WP-CLI:

Purge Cache

To purge some or all of the cache, the Pantheon Advanced Page Cache plugin provides several commands:

  • Purge the entire page cache: purge-all

  • Purge one or more surrogate keys from cache: purge-key {KEY1,KEY2...}

  • Purge one or more paths from cache: purge-path {PATH1,PATH2...}

Interact With Sessions Via The WP-CLI

Pantheon provides PHP Session control via the WP Native PHP Sessions plugin.

Install and activate the plugin:

This plugin provides two Terminus commands: pantheon session list and pantheon session delete, to list and delete active sessions respectively:

Refer to WordPress and PHP Sessions for more information on Sessions scalability and troubleshooting.

More Resources