SSH & WP-CLI

Every Templ website includes full SSH access to its container. Once connected, you can manage WordPress with WP-CLI, deploy with git, install packages with composer, and control the container with the Templ CLI.

Connect over SSH

The easiest way to open a shell is directly in your browser: navigate to the website in the Templ Panel, click the Connect button at the top right, then click Open SSH.

To connect from your own terminal, open the website's Overview tab and copy the ready-made command under SFTP/SSH → SSH Tools → SSH Command, then authenticate with either a password or SSH keys.

If you connect often, switch SSH Tools to SSH Config and add the generated block to your ~/.ssh/config. It defines an alias (your site's domain) with the host, port, and user filled in, so you can connect with just ssh <your-domain> instead of the full command.

Preinstalled tools

The following tools are available in every website's container and ready to use over SSH:

  • wp - WP-CLI, the command-line interface for WordPress
  • git - for version control and git push deployment
  • composer - for PHP dependency management, for example when setting up Bedrock
  • node - Node.js, with the n version manager for switching versions
  • templ - the Templ CLI for controlling your container

WP-CLI

WP-CLI is preinstalled and lets you manage WordPress from the command line. First change into your website's webroot, then run any wp command:

cd ~/app_xxxx
wp plugin list

Some commonly used commands:

wp plugin list                          # list installed plugins and their status
wp core update --minor                  # update core to the latest minor/security release
wp search-replace old.com new.com       # update URLs, e.g. after a migration
wp cache flush                          # flush the WordPress object cache

To run a WP-CLI command automatically on a schedule, see Custom cron jobs.

Deactivate plugins

Deactivate a single plugin by its slug, or all plugins at once - useful when a plugin is breaking the site or locking you out of WP Admin:

wp plugin deactivate <slug>       # deactivate one plugin
wp plugin deactivate --all        # deactivate every plugin

If the site is showing a critical error caused by a plugin or theme, add --skip-plugins --skip-themes so the command runs even when a plugin or theme has fatal errors that would otherwise prevent WP-CLI from loading:

wp plugin deactivate <slug> --skip-plugins --skip-themes

Reactivate a plugin the same way with wp plugin activate <slug>.

To deactivate a single plugin or all of them without the command line, you can also use the Panel's Deactivate Plugins tool.

Roll back a plugin to an older version

If a plugin update broke the site, reinstall the previous version:

wp plugin install <slug> --version=<version> --force

This works for plugins hosted on wordpress.org. Downgrading only replaces files, so it won't undo database changes the newer version already made.

Reset a user's password

If you're locked out of WP Admin and can't receive the reset email, set a new password directly:

wp user update <email> --user_pass='<new password>'

Node.js

Several Node.js versions are preinstalled and managed with the n version manager. List the versions available on your container:

n ls

To use a specific version, prepend it to your PATH in ~/.bashrc so the choice persists across sessions:

PATH=/usr/local/n/versions/node/<version>/bin:$PATH

Restart your SSH session for the change to take effect, then confirm the intended version is active:

node -v

Templ CLI

The templ command is the Templ Container CLI for controlling your container. Run templ on its own to see the available commands:

Usage: templ [options] [command]

Templ Container CLI

Options:
  -v,--verbose  Verbose output
  -s,--silent   No/minimal output
  -d,--debug    Debug output
  -h, --help    display help for command

Commands:
  version       Prints version.
  php           php related commands
  cache         cache related commands
  incident      Incident commands
  service       service related commands

The two you'll reach for most often:

templ php restart     # restart PHP for your website
templ cache purge     # purge the Templ Cache

Running the Templ CLI remotely

The templ shortcut only works from inside an SSH session on your container. To run a command remotely in one line, without opening an interactive session, call the full path to the binary instead:

ssh -p <PORT> <USER>@<IPADDR> /usr/bin/templ-ccli cache purge

This is useful for automation, for example purging the cache from a deploy script.