Plugins save path "/current/" instead "/releases/20.../"

Some plugins store full paths to files that generate or download and over time they are pointing to old files or paths that don’t exist (
e.g. /srv/www/mysite/releases/20170123113220/web/app/uploads/backups/)

To prevent (in part) this behavior and ensure WP_CONTENT_DIR is the same in all environments I have replaced in https://github.com/roots/bedrock/blob/master/config/application.php#L7 with:

$webroot_dir = preg_replace('/\/releases\/\d+\//', '/current/', $root_dir . '/web');

If it can be useful :slight_smile:

2 Likes

Interesting… I’d have to refresh my memory on how WP_CONTENT_DIR is used exactly. That might be a good solution for Trellis. Too bad we can’t really make that the default in Bedrock though since it’s not tied to Trellis (or any deployment methods).

You can add a TRELLIS environment variable and if it’s true make the replacement.

Wordpress functions (e.g. get_theme_file_path(), wp_upload_dir(), get_template_directory(), get_stylesheet_directory(), …) works as expected with /srv/www/mysite/current/web/ path.

Oh, definitely. I just meant we wouldn’t want to include that in Bedrock by default ideally. It should have no knowledge of Trellis.