Skip to content

WP_HOME not set correctly in .environment #46

@gilzow

Description

@gilzow

Identical to platformsh-templates/wordpress-bedrock#65

Currently, .environment sets WP_HOME as
export WP_HOME=$(echo $PLATFORM_ROUTES | base64 --decode | jq -r 'to_entries[] | select(.value.primary == true) | .key')
which returns the default route with a trailing slash. While not explicitly stated, it is implied in the docs thatWP_HOME should not include a trailing slash. Bedrock, in their application.php file builds on this assumption when assigning the value for WP_CONTENT_URL. Since we are including the trailing slash, generated pages end up with a double slash between the domain and the location of wp-content (app in the case of bedrock).

Example:
https://main-bvxea6i-dwo6kco2adisc.ca-1.platformsh.site//app/themes/twentytwentytwo/style.css?ver=1.2
vs
https://main-bvxea6i-dwo6kco2adisc.ca-1.platformsh.site/app/themes/twentytwentytwo/style.css?ver=1.2

We need to chop off the trailing slash from the returned route before assigning it to WP_HOME.

Then, because we're removing the slash, we'll need to add it between WP_HOME and wp in the next line when assigning the value to WP_SITEURL

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions