If you use WordPress to power your website and have a bit of technical knowledge (particularly of Linux shell), then taking advantage of the command line interface tool, wp-cli, might be of interest to you!
WP-CLI is a command line method of working with WordPress. Rather than triggering actions by logging in to the WordPress admin GUI, you do so when logged in via SSH command line. One advantage to using wp-cli is that you bypass the entire web server stack, including nginx, apache, fastcgi, and php, which can be advantageous particularly when running longer-running tasks (like imports/exports of data) since you’re no longer subjected to heavy timeout restrictions on each process.
Let’s get started:
- Log in to your Plesk system user account via SSH (If you have your own VPS, it’s best not to run this as root, but you can sudo to the domain’s system user account prior to running the commands)
- Change to your web root directory where WordPress is installed. The web root folder/dir for each domain is shown in Plesk. For your primary domain this is httpdocs.
- Run the following to download and run wp-cli’s info function:
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar php wp-cli.phar --info
For any wp-cli command you see in their documentation, simply cd to your web root dir and replace ‘wp’ with ‘php wp-cli.phar’.
If you get an error indicating that php doesn’t exist or errors about the PHP version being too old (this is likely), replace the php command with /opt/plesk/php/8.1/bin/php or swap out the ‘8.1’ with other versions of PHP like 7.4, 8.0, or 8.2. If none of those commands work it’s because your web host either does not have that version of PHP installed in Plesk or they haven’t added that version of PHP to the chroot. You’ll need to ask them to fix this, or consider switching to better Plesk web hosting!