Why does the theme require a wr_ database prefix, while the Bedrock site doesn’t?
So the theme accesses the database? I mean, there is sometimes some blurring of separation between view and model. So wr_ is hardcoded in the theme code then, it doesn’t use an environment variable as Bedrock/WordPress does? Wouldn’t it be a better idea to just replace wr_ with the environment variable for the database prefix?
At this point i don’t have enough knowledge to answer your 2 questions with precision.
Also considering with bedrock, sage theme lives under web\app\themes
while WordPress themes live under web\wp\wp-content\themes
And i am still figuring out how the bedrock ecosystem works.
The .sql file tables prefix is “wr_” and i think that’s all it should be; without the extra “wp_” tables that you get prompted if the DB_PREFIX= in the .env file is set to “wp”.
Prefix must be changed to “wr” otherwise you get prompted to create the wordpress backend info which is unnecessary!
Can you access/edit the theme code?
Are you developing locally, with version control (GIT) (hopefully)?
You could do a search for all occurrences of wr_ inside the theme folder (e.g. using Notepad++ or Visual Studio Code).
And then you can replace those wr_ string parts with the environment DB_PREFIX variable (env('DB_PREFIX')).
You have to exclude 3rd party code when searching through your project. A good IDE (as Visual Studio Code that is free) should already take the .gitignore file into account (even if you don’t use git, the file is there, as shown in the screenshot).
The screenshot contains lots of hits that are totally unrelated, from node_modules/ which contains the installed npm dependencies.
Maybe I misunderstand you but DB_PREFIX does (should) not affect the path of the wp-install which it sounds to me that you are saying it does pr you think it does. It only affects which DB tables WP is trying to use.
So if you change DB_PREFIX to ”wr_” and remove require_once(‘login.php’); that you mentioned above, can you access /admin or /wp-login.php (maybe wp/admin or wp/wp-login.php depending on your setup)? Note that you must not change the name of the wp-folder and if you have searched-replaced ”wp” to ”wr” that has to be undone.
DB_PREFIX shouldn’t affect the wp-folder, but maybe the previous dev has made it do so.
I guess if you try to change DB_PREFIX to something like “wq_” and see if you get redirected to /wq-admin will be the easiest way to find out.
If it doesn’t redirect to wq-admin, maybe the previous dev has done one of the things listed here: Renaming the WP-Admin Area – Loginizer, I guess you would have to check all the places mentioned in the article and/or search the entire project for “wr-” or “wr-admin”.
Another thing: judging by your URL in the browser screenshots, you probably haven’t set the docroot for Bedrock properly. See the next-to-last bullet at Bedrock: Installation | Roots Documentation . Its’ not related to the problem at hand but may be good to know.
If all else fails, maybe you should set up a blank Bedrock install without any code you got from the previous dev but using the provided DB. Set DB_PREFIX to ”wr_” and see what happens. If it still redirects, its somewhere in the DB and if it doesnt redirect, start adding old code and test until the redirect happens.