You are running a customized WordPress install where your configurations are NOT located in one of the two required locations (outside the webroot for example) and are receving the following error when running wp-cli
commands:
Error: Strange wp-config.php file: wp-settings.php is not loaded directly.
###Solution
Simply move the require_once ... wp-settings.php
line from the actual configuration file to the end of file that is requiring/including it. See below for examples.
This works by tricking the wp-cli regex into correctly parsing the configuration files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create the basic site structure | |
# Web server points to public/ keeping configuration outside of webroot | |
$ mkdir site && cd site | |
$ mkdir conf/ public/ | |
# Init repo | |
$ git init && git add . && git commit -m 'Init commit' | |
# Install WP as submodule to public/ | |
$ git submodule add git://github.com/WordPress/WordPress.git public/wp-core |