WP-CLI Cookbook for the FlyNode Terminal
The handful of WP-CLI commands people actually need, and how to run them in the in-browser terminal.
WP-CLI is WordPress from the command line. You can run it in the app's in-browser terminal (see Using the Terminal and Logs). FlyNode installs WP-CLI on the site the first time you use features such as Security, Staging or Updates. If the wp command is not found, open the Security tab once and try again.
Before you start
Choose the wordpress container in the terminal, move to the site's folder, and add --allow-root to every command (the terminal runs as the container's root user):
cd /var/www/vhosts/localhost/html
wp --allow-root core version
Everyday commands
# What is installed, and what needs an update
wp --allow-root plugin list
wp --allow-root theme list
wp --allow-root core check-update
# Turn a plugin off when it breaks the site (white screen)
wp --allow-root plugin deactivate plugin-name
# Leave maintenance mode if a page is stuck on it
wp --allow-root maintenance-mode status
wp --allow-root maintenance-mode deactivate
# Empty the caches
wp --allow-root cache flush
# Users
wp --allow-root user list
wp --allow-root user update 2 --user_pass='a-new-strong-password'
# Check that WordPress is installed and healthy
wp --allow-root core is-installed
wp --allow-root option get siteurl
Database commands
wp --allow-root db size --tables
wp --allow-root db export /tmp/backup.sql
wp --allow-root search-replace 'http://old.example.com' 'https://new.example.com' --all-tables --dry-run
Run search-replace with --dry-run first, read what it would change, then run it again without it.
Prefer the dashboard for updates (they take a backup and roll back on failure) and for pushing from staging. Use the terminal for inspecting and for small fixes, and take a backup before commands that change the database.
Still stuck?
Open a support ticket from your dashboard and include the container name.