Tuesday, 8 August 2017

How to Run WP-CLI Commands on a Remote Server

This weekend at WordCamp Minneapolis I presented an introduction to the power of WP-CLI, a tool that allows you to manage your WordPress website from the command line. I’ve given this talk several times now, but am always looking for cool new features to include. This weekend’s addition to my talk was the ability to run WP-CLI commands from my local machine against a remote site…. which is very cool, and saves even more time.
The Old Way
SSH into Remote Server
Change Directory to where my WordPress Site is installed
Execute WP-CLI command.
The New Way
Execute WP-CLI Command
Step 1: Setting It Up
In order to run commands remotely, you need to install WP-CLI on both the computer you want to run the command from and the server on which your site is located.
I would also recommend setting up passwordless-ssh on your server so that you don’t need to enter your password every time you run a WP-CLI command.
Step 2: Execute the Remote Command
The trick to running commands on a remote server is the –ssh option. Adding this option to any command will tell it to SSH into the remote server and execute the command there. For example, running
wp –ssh=shawn@example.com/var/www/html/
Source: https://managewp.org/articles/15814/how-to-run-wp-cli-commands-on-a-remote-server

source https://williechiu40.wordpress.com/2017/08/08/how-to-run-wp-cli-commands-on-a-remote-server/

No comments:

Post a Comment