How to convert Kinsta-based Trellis and Bedrock to vanilla WordPress [checklist]

You can do so by going to the website in Kinsta -> Backups -> Manual.

Make sure you a add a descriptive backup note such as "before converting trellis to vanilla wordpress" so you know which backup to restore if things went sideways.

Now that you're in public, type cat current/composer.json and look for "roots/wordpress".

If you found "roots/wordpress": 5.5.1 in the previous step, you'd do the below:

wp core download --version=5.5.1

create a wp-config.php file with database credentials from Kinsta's dashboard and the prefix from the current database.

wp config create --dbname="mosaad" --dbuser="mosaad" --dbpass="mosaad123" --dbprefix="wp_"

rsync -vrz current/web/app/ wp-content

rsync -vrz shared/uploads/ wp-content/uploads

rm bedrock-autoloader.php disallow-indexing.php register-theme-directory.php

Go to Kinsta's chat in the bottom-right corner and ask them to reset the root directory to be public instead of public/current for the website you're converting.

Example "Hey there, please reset the root directory for mosaad2 to be public"

The below assumes the production url contains www.. It makes sure to replace any old urls with http only or without www. as well.

wp search-replace "/app/" "/wp-content/" &&
wp search-replace "http://mosaad.com" "https://www.mosaad.com" &&
wp search-replace "https://mosaad.com" "https://www.mosaad.com" &&
wp search-replace "http://www.mosaad.com" "https://www.mosaad.com" &&
wp search-replace "https://www.mosaad.com/wp" "https://www.mosaad.com" &&
wp option update home "https://www.mosaad.com" &&
wp option update siteurl "https://www.mosaad.com"

Note: the order of these search-replace matters. if you replaced the domain before you replace /app/ with /wp-content/ you might end up with urls in the database like https://www.mosaad.com-content/uploads/06/img.png which will break media links.

Check Redirects in your Kinsta's dashboard and make sure no rule is redirecting /wp-content/ to /app/ or any url to the old */wp/ format.

You can do so from your WordPress admin or from tools in your Kinsta's dashboard.

If you have image optimization plugins such as Nitro or OptiMole, make sure you clear their cache as well.

rm -rf releases current shared

I personally use Bitbucket Pipelines but you can use any CI service you wish.

Make sure you check your theme for any url that contains /app/ and replace it with /wp-content/ or be a better developer and do it dynamically the proper way.

If you used something like if(WP_ENV === 'production') it will fail because that was generated by Trellis. You can either define it for live website manually by editing the wp-config.php file or remove these if statements from your theme.

Need help?

If the above didn't work for you or you wish for me to expand on the why behind any of it, tweet at me. I'm very friendly.