From 2892b24c36a1e2be167e397864d3dafafca79f64 Mon Sep 17 00:00:00 2001
From: Kevin Cristiano <kcristiano@kcristiano.com>
Date: Wed, 13 Feb 2019 07:59:08 -0500
Subject: [PATCH] CMS path fix in wp-cli #147 props aydun

---
 wp-cli/civicrm.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/wp-cli/civicrm.php b/wp-cli/civicrm.php
index f093e165ec..c740547873 100644
--- a/wp-cli/civicrm.php
+++ b/wp-cli/civicrm.php
@@ -165,6 +165,12 @@ if ( ! defined( 'CIVICRM_WPCLI_LOADED' ) ) {
 				return WP_CLI::error( "Unrecognized command - '$command'" );
 			}
 
+			# if --path is set, save for later use by Civi
+			global $civicrm_paths;
+			if (!empty(WP_CLI::get_config('path'))) {
+				$civicrm_paths['cms.root']['path'] = WP_CLI::get_config('path');
+			}
+
 			# run command
 			return $this->{$command_router[ $command ]}();
 
-- 
GitLab