1

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.

2

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.

2
  • Thanks Christian. I'll stick with wp cv whenever I can... but I think I can only use cv for api4 right now. – Martin_W Mar 28 at 4:46
  • 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. – Christian Wach Mar 29 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.