udx / wp-stateless

WP-Stateless is a WordPress plugin that uploads and serves your WordPress media from Google Cloud Storage.
https://stateless.udx.io
MIT License
261 stars 63 forks source link

WPML media translation support #345

Open alimuzzaman opened 5 years ago

alimuzzaman commented 5 years ago

https://wordpress.org/support/topic/wpml-support-101/ https://wpml.org/forums/topic/incompatibility-between-wpml-and-wp-stateless-plugin/

Hallo there, There seems to be an incompatibility between wp-stateless and WPML https://wpml.org/forums/topic/incompatibility-between-wpml-and-wp-stateless-plugin/#post-3065622

One of the suggestions from the WPML team was to contact you and point you to the https://wpml.org/documentation/theme-compatibility/go-global-program/ where they can help other 3rd party developers make their plugins compatible with WPML.

Is it (or could it be) part of your planning to try for compatibility with WPML?

MB-Jan commented 4 years ago

Is there any update on this?

diogoterremoto commented 4 years ago

It appears that this plugin is still not compatible with WPML. This is really unfortunate, as this plugin is very cool.

sagarsdeshmukh commented 3 years ago

Any chances to release a fix on this issue, waiting for this fix since 2019?

diogoterremoto commented 3 years ago

It appears that the field WP-Stateless sm_cloud from the original media is not copied. Maybe when WPML duplicates the post when that field isn't there. So this appears to be a race condition.

Things I've tried:

However there is a workaround. It envolves asking WPML to duplicate the successfully GCS uploaded media post fields to the linked/translated (and not uploaded to GCS) one. I think this is not good UX. I would prefer my clients to just upload the media again.

diogoterremoto commented 3 years ago

I think I got something working.

Basically, there is a wp_stateless_media_synced filter being applied by the plugin after the media is successfully uploaded to GCS. Using that hook, the sm_cloud field is copied to all other translations.

I don't know if there is a better way of doing it, but it's seems to be working via WordPress interface.

sagarsdeshmukh commented 3 years ago

Thank you @diogoterremoto It works 💯