Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
flywheel wp-cli support
# the two lines below need to be added to ~/.wp-cli/config.yml or the appropriate configuration file.
# see for details about the location and name of wp-cli's config files.
- flywheel.php
/** From Emerson Carter at Flywheel Support.
* Grants the ability to execute WP CLI commands remotely.
* Place this file in ~/.wp-cli.
* @link
WP_CLI::add_hook( 'before_ssh', function() {
$host = WP_CLI\Utils\parse_ssh_url( WP_CLI::get_runner()->config['ssh'], PHP_URL_HOST );
$flywheel_path = 'WP_CLI_SSH_PRE_CMD=export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ;
// FIXME: replace with correct hostnames or SSH host aliases.
$flywheel_hosts = [ 'your-host-1', 'your-host-2', 'your-host-3', ] ;
// only add path to flywheel hosts.
if ( in_array ( $host, $flywheel_hosts ) ) {
putenv( $flywheel_path );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment