Closed djmtype closed 4 years ago
Hey @djmtype this plugin loads when the front-end is ready to load: https://github.com/junaidbhura/auto-cloudinary/blob/master/inc/namespace.php#L53-L60
Maybe you could try that initialization code on init
in your functions.php file and see if that works?
add_action(
'init',
function () {
\JB\Cloudinary\Core::get_instance()->setup();
\JB\Cloudinary\Frontend::get_instance()->setup();
}
);
Note: I'd recommend testing this locally or on a dev environment.
@junaidbhura Unfortunately, that didn't work. The image paths do not reference the Cloudinary paths in any of the endpoints within the API. For example, http://wp-site.com/wp-json/wp/v2/posts/
Hey @djmtype in addition to the init
hook above, could you also add this?
add_filter( 'cloudinary_allow_rest_api_call', '__return_true' );
@junaidbhura Worked like a charm. Thank you very much!
No worries @djmtype , happy to help :)
I think just to be safe, you could future-proof the code some more like so:
if ( class_exists( '\JB\Cloudinary\Core' ) ) {
add_action(
'init',
function () {
\JB\Cloudinary\Core::get_instance()->setup();
\JB\Cloudinary\Frontend::get_instance()->setup();
}
);
add_filter( 'cloudinary_allow_rest_api_call', '__return_true' );
}
Of course, in case this plugin is disabled or doesn't exist, no fatal errors are thrown. Thanks again!
That's right. Cheers!
Logically, plugins don't work with a headless Wordpress setup. But, is there anyway to leave Cloudinary's CDN URL intact when exporting a Gridsome/Gatsby site? Using the auto content images option BTW.