Skip to main content
Last Reviewed: October 06, 2022

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:

terminus wp -- $SITE.$ENV pantheon cache set-maintenance-mode everyone

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:

terminus wp $SITE.$ENV -- plugin install pantheon-advanced-page-cache --activate

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

    terminus wp -- $SITE.$ENV pantheon cache purge-all
  • Purge one or more surrogate keys from cache: purge-key {KEY1,KEY2...}

    terminus wp -- $SITE.$ENV pantheon cache purge-key {KEY1,KEY2...}
  • Purge one or more paths from cache: purge-path {PATH1,PATH2...}

    terminus wp -- $SITE.$ENV pantheon 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:

terminus wp $SITE.$ENV -- plugin install wp-native-php-sessions --activate

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

terminus wp -- $SITE.$ENV pantheon session list

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

More Resources