pantheon-systems / wordpress-composer-managed

WordPress boilerplate with Composer, easier configuration, and an improved folder structure
https://docs.pantheon.io/guides/wordpress-composer
MIT License
4 stars 4 forks source link

[CMSP-1140] Fix core resource URLs for non-main sites in subdirectory multisite network #130

Closed jazzsequence closed 4 months ago

jazzsequence commented 4 months ago

This pull request fixes the issue with core resource URLs for non-main sites in a subdirectory multisite network. Previously, the URLs were not being correctly adjusted, causing broken links to core resources (like CSS or JavaScript files). This PR adds a filter function fix_core_resource_urls that corrects the URLs by replacing the current site path with the main site URL. The filter is only applied to non-main sites in a subdirectory multisite network.

This problem comes from the custom directory structure used by Roots Bedrock. All the filter hooks are set to priority 9 so they can be easily overridden downstream.

jazzsequence commented 4 months ago

is this something that could/should be contributed upstream to Bedrock, or is it specific to our implementation?

I'm not convinced it's Bedrock but I'm also not sure how it's not. It's possible they changed things and we haven't pulled down their latest code because this wasn't an issue a year ago. At any rate, I'm pretty confident that we're isolating to only scenarios that would actually be affected but I agree about tests. Currently, we don't have any tests, but I believe we have a ticket to create some, so...