qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
554 stars 105 forks source link

Incorrect work with ACF Rest API #1221

Open naumovtop opened 2 years ago

naumovtop commented 2 years ago

Hello! Thanks for your help I have a trouble: I have standard field content and ACF field Textarea1 with type Textarea(qTranslate-X) If I want to create draft by POST response, like https://example.com/wp-json/wp/v2/posts/ With body

{
     "title" : "Post1",
    "content" : "[:en]Hello![:es]Hola![:]",
    "status" : "draft",
    "acf" : {
    "textarea1" : "[:en]Hello![:es]Hola![:]"
}
}

So, if I do this, in content field everything is ok, but textarea1 will be empty. And I can't find solution, but if I install old plugin "Advanced Custom Fields: qTranslate" - everything is working. But I know, that ACF compability is already in this version of qtranslate-xt.

And also, if I want to get info about other, already published post by GET response like https://example.com/wp-json/wp/v2/posts/1, also I get content field normally, but in Textarea1 I only see text in one language, not text like:[:en]Hello![:es]Hola![:] Thank you!

naumovtop commented 2 years ago

Can somebody help me with that?

herrvigg commented 1 year ago

Duplicate https://github.com/qtranslate/qtranslate-xt/issues/1093#issuecomment-1014672681.

but if I install old plugin "Advanced Custom Fields: qTranslate" - everything is working.

I don't understand how the old plugin could change that behavior... and first of all, how can you use that legacy plugin with the ACF module in qTranslate-XT? That is not possible, it's incompatible. What version of qTranslate-XT are you using?

herrvigg commented 1 year ago

For the last point:

And also, if I want to get info about other, already published post by GET response like https://example.com/wp-json/wp/v2/posts/1, also I get content field normally, but in Textarea1 I only see text in one language, not text like:[:en]Hello![:es]Hola![:]

This is by design, the API REST will work as a regular front query, it is providing the results in a given language. If you want es you would go to: https://example.com/es/wp-json/wp/v2/posts/1

We don't have anything special to retrieve the RAW values. Maybe we'd need some new /raw/ point? https://example.com/raw/wp-json/wp/v2/posts/1 or https://example.com/wp-json/wp/v2/posts/1?lang=raw But I'm not so sure. This would be a new feature in any case.