-
Notifications
You must be signed in to change notification settings - Fork 219
Mini Cart: Fix loading deps when WordPress is installed in a subdir #6673
Conversation
Fix loading deps when WordPress is installed in a subdir
I'm going to add @dinhtungdu as a reviewer because I'm not sure about my approach and this issue is a little bit tricky: I prefer that more eyes will review this! |
Size Change: 0 B Total Size: 876 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gigitux This is working as expected on my end. I think we can use this approach just fine. If I have to change anything in this PR, I would:
- Use the site URL directly without parsing the path.
- Use a simpler way to check whether script
src
is an URL. Thewp_http_validate_url()
seems to be an overkill for this task to me.
You can also look at how Core is dealing with the script src
here (and here).
Thanks for the review and links! I updated the PR 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
This PR fixes the loading of Mini Cart deps when WordPress is installed in a subdirectory. Fixes #6500.
Without these changes, the Mini Cart deps are ALWAYS loading from the root of the website, but this is wrong because WordPress could be installed in a subdirectory.
How to reproduce the error
For reproducing the error, it is necessary installing WordPress in a subdirectory. The quickest and easiest way that I found it is:
wordpress
(as the guide suggests).wrong request (missing
/wordpress
)with the changes of this PR, the browser fetches deps from the right URLs
Testing
User Facing Testing
Check out this branch
WooCommerce Visibility