Answers.Body: <p>Thanks to the helpful comments, I conclude: Yes it can, with a bit of help.</p>
  
  <h2>TL;DR</h2>
  
  <ul>
  <li>you need to define <code>CIVICRM_CMSDIR</code> in your code</li>
  <li>you need set <code>CIVICRM_SETTINGS</code> as an environment var</li>
  </ul>
  
  <h2>Longer version</h2>
  
  <p>As far as I can work out, <code>cv</code> sources <code>civicrm.settings.php</code> before it sources <code>wp-config.php</code>. So if, like me, you have config set in <code>civicrm.settings.php</code> that depends on constants defined in <code>wp-config.php</code> you'll have to find a solution for that (e.g. use <code>if (defined('...'))</code> or put them all in a separate file and <code>require_once(...)</code> it.)</p>
  
  <p>Then you need something like this in your <code>civicrm.settings.php</code>:</p>
  
  <pre><code>define('CIVICRM_CMSDIR', __DIR__ . '/wp');
  </code></pre>
  
  <p>Basically CiviCRM is going to expect to find <code>wp-includes</code> inside that directory, so adjust as you need to.</p>
  
  <p>You don't need to call <code>cv</code> from within any particular directory, according to my tests.</p>
  
  <p>You need to set the environment variable <code>CIVICRM_SETTINGS</code> to point to the <code>civicrm.settings.php</code> file. This can be a relative or absolute path.</p>
  
  <p>I was then able to get cv to run, e.g. to use the API. Now if only I could get my tests to run....!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-01T16:05:24.100Z
Answers.LastActivityDate: 2016-12-01T16:05:24.100Z
Answers.UserDisplayName: artfulrobot
Body: <p>A wordpress install I'm adding CiviCRM to is setup in a non-standard way, specifically:</p>
  
  <pre><code>docroot
  \- civicrm.settings.php
  \- wp-config.php
  \- content/
  |  \- plugins
  |  | \- civicrm
  |  \- uploads
  |     \- civicrm
  \- wp (wp codebase in here)
  </code></pre>
  
  <p>I've got CiviCRM working fine, but I can't get my tests to run that rely on booting CiviCRM from <code>cv php:boot</code>. Trying to run <code>CIVICRM_SETTINGS=civicrm.settings.php cv -vvv ...</code> from the docroot just silently dies. I'm using cv version <code>b3db22c</code>.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-29T19:10:11.277Z
Comments.Text: Does it have the same problem if `CIVICRM_SETTINGS` contains the full path?
Comments.UserDisplayName: Tim Otten
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-29T21:10:27.007Z
Comments.Text: 'fraid it makes no difference specifying the full path. And just to test, if I give a duff path it complains loudly in a big red box.
Comments.UserDisplayName: artfulrobot
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-01T15:19:22.600Z
Comments.Text: I'm not well versed in this, so I could be way off, but shouldn't you be running that command from inside the wp dir, perhaps even deeper, with a full path for the CiviCRM_Settings call?  Doesn't cv want to be inside the wp dir?
Comments.UserDisplayName: G H
Tags: <testing><cv>
Title: Can cv handle custom Wordpress installs?
ThreadText: # Can cv handle custom Wordpress installs?
  
  (Asked by: username_0 on 2016-11-29)
  
  A wordpress install I'm adding CiviCRM to is setup in a non-standard way, specifically:
  docroot
  \- civicrm.settings.php
  \- wp-config.php
  \- content/
  |  \- plugins
  |  | \- civicrm
  |  \- uploads
  |     \- civicrm
  \- wp (wp codebase in here)
  
  I've got CiviCRM working fine, but I can't get my tests to run that rely on booting CiviCRM from cv php:boot. Trying to run CIVICRM_SETTINGS=civicrm.settings.php cv -vvv ... from the docroot just silently dies. I'm using cv version b3db22c.
  
  **Tags:** testing, cv
  
  > **Comments:**
  > **username_1**: Does it have the same problem if `CIVICRM_SETTINGS` contains the full path?  
  > **username_0**: 'fraid it makes no difference specifying the full path. And just to test, if I give a duff path it complains loudly in a big red box.  
  > **username_2**: I'm not well versed in this, so I could be way off, but shouldn't you be running that command from inside the wp dir, perhaps even deeper, with a full path for the CiviCRM_Settings call?  Doesn't cv want to be inside the wp dir?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-12-01. Score: 2 | Accepted answer
  
  Thanks to the helpful comments, I conclude: Yes it can, with a bit of help.
  TL;DR
  
  you need to define CIVICRM_CMSDIR in your code
  you need set CIVICRM_SETTINGS as an environment var
  
  Longer version
  As far as I can work out, cv sources civicrm.settings.php before it sources wp-config.php. So if, like me, you have config set in civicrm.settings.php that depends on constants defined in wp-config.php you'll have to find a solution for that (e.g. use if (defined('...')) or put them all in a separate file and require_once(...) it.)
  Then you need something like this in your civicrm.settings.php:
  define('CIVICRM_CMSDIR', __DIR__ . '/wp');
  
  Basically CiviCRM is going to expect to find wp-includes inside that directory, so adjust as you need to.
  You don't need to call cv from within any particular directory, according to my tests.
  You need to set the environment variable CIVICRM_SETTINGS to point to the civicrm.settings.php file. This can be a relative or absolute path.
  I was then able to get cv to run, e.g. to use the API. Now if only I could get my tests to run....!
  
  
  ---
  
  