junaidbhura / auto-cloudinary

Super simple Cloudinary auto-upload implementation for WordPress.
https://wordpress.org/plugins/auto-cloudinary/
MIT License
40 stars 9 forks source link

Plugin is not working with relative URLs #17

Closed JimSeven closed 5 years ago

JimSeven commented 5 years ago

If you change the output of the function wp_get_attachment_url through the wp_get_attachment_url filter to relative URLs the plugin won't work anymore.

This causes the str_replace function in class-core.php on line 116 to stop working.

A solution could be to run the following code snippet before the str_replace function:

        if (!array_key_exists('host', parse_url($original_url))) {
            $original_url = get_home_url() . $original_url;
        }
junaidbhura commented 5 years ago

Hey @JimSeven this plugin currently has no plans to support relative URLs. You can change the URL by using hooks in your plugin or theme:

https://github.com/junaidbhura/auto-cloudinary/wiki/Filters