Skip to content

Use mangle_url() function on 'content_url' and 'plugins_url' filters#121

Open
r-a-y wants to merge 1 commit intohumanmade:masterfrom
r-a-y:fix/more-mangle-url
Open

Use mangle_url() function on 'content_url' and 'plugins_url' filters#121
r-a-y wants to merge 1 commit intohumanmade:masterfrom
r-a-y:fix/more-mangle-url

Conversation

@r-a-y
Copy link
Contributor

@r-a-y r-a-y commented Oct 15, 2020

Proper fix for #33.

@splaquet
Copy link

out of curiosity... when the mangle_url function is working correctly, does it re-map the alias/mapped domain for all of the parent domain references?

as an example:
if I'm using domain.com, and I map/alias domainabc.com, the .css/.js/etc are still referencing the domain.com when viewing domainabc.com. and, as expected, this leads to CORS issues.

i'm not exactly sure how to fix that issue via CORS policy update in .htaccess. we're using well over a dozen different domains within our multisite environment.

@r-a-y
Copy link
Contributor Author

r-a-y commented Oct 27, 2020

When you are on the alias site, it switches the subdomain asset URLs to the alias URL.

For example, subdomain.example.com/wp-content/plugins/some-plugin/js.js to alias.com/wp-content/plugins/some-plugin/js.js.

This PR helps to fix these assets if a plugin utilizes plugins_url() or content_url() to set their asset URL.

@tomjn
Copy link
Contributor

tomjn commented Aug 22, 2023

@r-a-y I see #33 got closed by the author:

Closing this for being a bad idea. Sorry for keeping this open for so long, I just forgot about it.

Does it make sense to close this? I'm not sure what the benefit of doing this is, it was never clearly outlined

@r-a-y
Copy link
Contributor Author

r-a-y commented Aug 22, 2023

Thanks for getting to this, @tomjn .

I see #33 got closed by the author

Ping @carstingaxion .

Does it make sense to close this? I'm not sure what the benefit of doing this is, it was never clearly outlined

I mention the utility of this in the comment above.

Some plugins use content_url() or plugin_url() to generate their asset URLs such as CSS, JS, images, etc. Without this PR, the asset URLs by these plugins would use the subdomain host instead of the alias domain host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants