Changing DB Table Prefix

I ran an install already with wp_ as the current prefix but I’d like to update this.

Where can I make that change in Bedrock?

1 Like
1 Like

Thought I’d share an update on my process on this topic.

After manually writing this a few times I began using the getenv function which is much easier.

change in application.php

From

$table_prefix = 'wp_';

to

$table_prefix = getenv('PREFIX'); 

Add line to .env

PREFIX=wp_ or any prefix you need.
1 Like

Yea I did the same.

Just add the following to .env:

WP_TABLEPREFIX=myprefix_

Then in config/application.php in the DB Settings section I added:

$table_prefix = getenv('WP_TABLEPREFIX');
2 Likes

I understand this is old, but it is also something that I think is important. (This is also the first result I found when looking for how to configure the option.)

Has this been added as a standard config feature in .env file in 8.0.0?

If it hasn’t, I’d like to recommend it.
I’ll file a feature request on GitHub if that’s preferred.

1 Like
1 Like

@benword, awesome! Glad to see it. :smile:

Sorry to ask without searching the repo, but in some cases I find it more efficient to ask those who would know.

1 Like