Thank you for contacting WPML support, I'd be happy to help you with this issue.
According to the debug log, I see the post translation preference is "Translatable - use translation if available or fallback to default language" in WPML > Settings.
If the translation of the post is in Draft mode, only the administrator can view it. You can go to the admin area > Edit the post in English > Switch the language to Spanish with the language switcher at the topbar > Publish or delete it to allow the visitor to view the English content when switching to Spanish in the frontend.
yes, indeed I have enabled that setting to show up the content in English by default.
But while I'm translating a post (in Spanish for example) which could take more days, I don't want a visitor who clicks on Spanish from the English post to get a 404 message, but still the English content (as the translation is not yet published)
That seems a bug to me.
you can really reproduce this while on this post: hidden link
I see the issue on that post. It is expected behavior when the translation of the post is in Draft mode. You can consider switching the translation preference of the post to "Translatable - only show translated items" in WPML > Settings > Post Type Translation, to display only translated posts in the frontend.
Hi,
I cannot switch to "Translatable - only show translated items" as we want to show on the blog page all posts (english and other languages when translation is available) to avoid that the page looks too empty.
As I already mentioned, there could be cases when we are working on a translation and it will be saved as draft for several days, and I don't really think that it should be the expected behaviour to give the user a 404 error when he tries to switch on spanish..
I'm really looking forward to find a workaround for this issue!
Please try this workaround to use the translation memory in Advanced Translation Editor (ATE) as the draft translation and let me know if it helps.
1. Edit the post in English language > Switch to WordPress editor > Duplicate the post into Spanish language.
2. Switch back to WPML editor > Click on the Pen icon to translate the post in ATE.
Then the English content will be displayed in Spanish language (duplicate), and you can still continue translating the content in ATE.
Hello!
I'm afraid this solution is not scalable and not good enough (btw I'm not using ATE for page translations), it seems too complicated, especially when I have to do this for multiple pages.
Sorry but this still seems to me a bug and should never be be an expected behaviour.
It reminds me of an old issue where draft translations where listed in the wp_query and were giving the same 404 message until you fixed it in an update.
I would expect you do the same with this issue, please.