-
Notifications
You must be signed in to change notification settings - Fork 3
Fails when WordPress is in a subdirectory #17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
No idea why it's not working. Here are some debugging questions:
|
Yep! Debug output:
Didn't notice this error before, but that explains why it thinks WP is not installed. |
Hm, it shouldn't be hitting |
Ah, this was an older test install and hadn't been updated for a while. It was running 4.5.2. After updating to 4.7.3, I'm getting the same error, from a different file:
Still getting this
|
Is And, to confirm, the site loads properly in your browser? |
The site does load in the browser just fine. Bedrock sets the If the database config was a problem, I would expect that I should not be able to run commands like this:
|
Huh. Not sure what the issue is then without being able to debug further. Btw, this will eventually land in |
I came across the error messages above using For comparison, I have no familiarity with the wp-cli codebase, but perhaps some 💚 Thank you for wp-cli! |
Nice find @fullyint. I took another look and found the real cause. It seems as though wp-cli is actually loading the wp-config code twice as you can see from this snippet where I added
Because Bedrock sets the @danielbachhuber Is this double loading of wp-config necessary? @fullyint You can modify Bedrock to work with this command by moving the diff --git a/config/application.php b/config/application.php
index aecdc8b..9414d30 100644
--- a/config/application.php
+++ b/config/application.php
@@ -54,7 +54,6 @@ define('DB_PASSWORD', env('DB_PASSWORD'));
define('DB_HOST', env('DB_HOST') ?: 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
-$table_prefix = env('DB_PREFIX') ?: 'wp_';
/**
* Authentication Unique Keys and Salts
diff --git a/web/wp-config.php b/web/wp-config.php
index b53a2e7..ca9d7eb 100644
--- a/web/wp-config.php
+++ b/web/wp-config.php
@@ -6,4 +6,5 @@
*/
require_once(dirname(__DIR__) . '/vendor/autoload.php');
require_once(dirname(__DIR__) . '/config/application.php');
+$table_prefix = env('DB_PREFIX') ?: 'wp_';
require_once(ABSPATH . 'wp-settings.php'); |
Can Bedrock use
Right now, yes, but it is a bit of a hack.
Related wp-cli/db-command#15 I'm open to eventually changing this, but no set timeline for doing so. wp-cli/db-command#50 |
Also, glad you were able to figure out an interim fix :) |
Changing the I'm not very confident that the Roots group would accept this change though as it isn't really addressing a problem with Bedrock. Perhaps I'll suggest. In the meantime, this isn't too bad. |
E.g. Using Bedrock
Vanilla WP
Any ideas why this command would work differently than others?
The text was updated successfully, but these errors were encountered: