The uploads folder does not always reside within `get_site_url()`.
hackles opened this issue · 2 comments
Describe the bug
The uploads folder does not always reside within get_site_url(). In cases where it doesn't, URL replacement does not work as expected.
To Reproduce
Steps to reproduce the behavior:
- Install WordPress in a subdirectory, such as Bedrock
- Install and activate Optimole
- Image rewrites will not work.
Please note that there might be other scenarios in which get_site_url() would be incorrect, such as defining UPLOADS or WP_CONTENT or WP_CONTENT_URL.
Expected behavior
Image rewrites should work.
Isolating the problem (mark completed items with an [x]):
- I have deactivated other plugins and confirmed this bug occurs when only Optimole plugin is active.
- This bug happens with a default WordPress theme active
- I can reproduce this bug consistently using the steps above.
WordPress Environment
WordPress Version: 5.1
Optimole Version: current development branch
PHP versions: 7.2
Resolutions
I personally was able to use get_home_url() as a drop-in replacement and It Just Works™. But other ideas might be to use WP_CONTENT_URL or some wizardry with wp_upload_dir(), depending on what sort of non-standard environments you guys wish to support.
@hackles nice catch, thanks a lot for reporting.
I have added the patch in the upcoming release, let me know if you spot any other issues or you have any other suggestions.
🎉 This issue has been resolved in version 2.0.4 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀