Answers.Body: <p>You can safely ignore this setting unless you're hitting scripts in <code>civicrm/extern</code> or <code>civicrm/bin</code> or using <code>cv</code> directly. In that case I'd recommend switching to routes that go via WordPress e.g. the REST API or <code>wp cv</code> instead - they are much more reliable in WordPress.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-28T04:46:05.580Z
Answers.Text: Thanks Christian. I'll stick with `wp cv` whenever I can... but I think I can only use `cv` for `api4` right now.
Answers.UserDisplayName: Martin_W
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-29T08:56:41.277Z
Answers.Text: Yes, that's true. API v3 still has greater coverage though. FYI the `wpLoadPhp` setting was introduced because it is impossible for plugins to know where WordPress is located. So you're right - use `wp cv` to update `wpLoadPhp` then you should be able to use `cv` for API v4.
Answers.UserDisplayName: Christian Wach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-27T15:46:38.093Z
Answers.LastActivityDate: 2021-03-27T15:46:38.093Z
Answers.UserDisplayName: Christian Wach
Body: <p>On my Civi WordPress multisite installation, I just discovered that there is a <code>wpLoadPhp</code> setting in the CiviCRM settings <em>for each Civi domain</em> that contains the absolute filesystem path to <code>wp-load.php</code> (for example: <code>/home/myusername/sites/mydomain.org/wp-load.php</code>). So this setting needs to be updated if I move WordPress+Civi to a new location, or move a copy of the Civi database to a development or test installation.</p>
  <p>I discovered this setting when the Civi <code>cv</code> CLI tool misbehaved—it tried to load settings from the wrong WordPress installation for a <code>cv api setting.create ...</code> command. (However, using the WP-CLI  <code>wp cv api setting.create ...</code> worked correctly. It must override the Civi <code>wpLoadPhp</code> setting.)</p>
  <p>What is the correct/best way to update the <code>wpLoadPhp</code> setting—preferably via a script for automation? Is <code>wp cv api setting.create ...</code> best? It seems to work OK: e.g. <code>wp cv api setting.create wpLoadPhp=/home/myusername/sites/mydomain.org/wp-load.php</code>.</p>
  
Tags: <wordpress><settings><multisite><migration>
Title: How to update "wpLoadPhp" setting for CiviCRM WordPress when moving/migrating installation?
ThreadText: # How to update "wpLoadPhp" setting for CiviCRM WordPress when moving/migrating installation?
  
  (Asked by: username_0 on 2021-03-24)
  
  On my Civi WordPress multisite installation, I just discovered that there is a `wpLoadPhp` setting in the CiviCRM settings *for each Civi domain* that contains the absolute filesystem path to `wp-load.php` (for example: `/home/myusername/sites/mydomain.org/wp-load.php`). So this setting needs to be updated if I move WordPress+Civi to a new location, or move a copy of the Civi database to a development or test installation.
  
  I discovered this setting when the Civi `cv` CLI tool misbehaved—it tried to load settings from the wrong WordPress installation for a `cv api setting.create ...` command. (However, using the WP-CLI `wp cv api setting.create ...` worked correctly. It must override the Civi `wpLoadPhp` setting.)
  
  What is the correct/best way to update the `wpLoadPhp` setting—preferably via a script for automation? Is `wp cv api setting.create ...` best? It seems to work OK: e.g. `wp cv api setting.create wpLoadPhp=/home/myusername/sites/mydomain.org/wp-load.php`.
  
  **Tags:** wordpress, settings, multisite, migration
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-27. Score: 2 | Accepted answer
  
  You can safely ignore this setting unless you're hitting scripts in `civicrm/extern` or `civicrm/bin` or using `cv` directly. In that case I'd recommend switching to routes that go via WordPress e.g. the REST API or `wp cv` instead - they are much more reliable in WordPress.
  
  > **Comments:**
  > **username_0**: Thanks username_1. I'll stick with `wp cv` whenever I can... but I think I can only use `cv` for `api4` right now.  
  > **username_1**: Yes, that's true. API v3 still has greater coverage though. FYI the `wpLoadPhp` setting was introduced because it is impossible for plugins to know where WordPress is located. So you're right - use `wp cv` to update `wpLoadPhp` then you should be able to use `cv` for API v4.  
  
  ---
  
  