To troubleshoot the issue further I setup a Sandbox site for you which you can login to using the next link:
hidden link
Can you please upload your custom theme or code to the site, and also setup WPML and add a few posts so as to try to replicate the issue there and see how it goes?
if the issue is replicated please let me know the location of your custom code to pull the posts along with the URL/steps for me to see/check the issue.
I could paste my code in functions.php and create a test blog article and translation (in french)
Important premise: In WPML settings I set up posts as "translatable - use translation if available or fallback to default language".
So then i created a custom shortcode "blog_list" listing simply the posts on hidden link and works great on EN and FR as long as the translations are published.
but look what happens if I set up the french translation as draft again: I'm navigating on the blog page (FR version) here: hidden link and the list shows a blog post "blog post EN 1" which is correct, but the permalink points to hidden link which is incorrect (if accessed as logged out, will give a 404).
This is exactly my problem!
is this a bug or am I missing something?
The issue has now been confirmed and escalated to our development team. In the mean time can you please try the following workaround and see if it fixes the issue:
- Backup the site completely to prevent any issues.
- edit the file: \wp-content\plugins\sitepress-multilingual-cms\classes\core-abstract-classes\class-wpml-element-translation.php in your WordPress directory.
- Find the following code in line 293-318 of the file
Thank you for confirming that the workaround works.
The issue has been escalated to our development team and a proper fix will be available in the future release of WPML. However the fix might not be available in the immediate next release as the issue still requires more testing to find the best fix and proper testing to make sure no other features are affected with this fix. So please keep a note of this workaround and apply this again in future WPML updates till the fix is released.
I will send you an update here if we need more details or after the fix is released with WPML update.
hello!
any news from the dev team on analyzing and fixing this bug?
I noticed that, while this quick workaround worked fine initially, now it brakes other functionalities like the language box in the sidebar, that is not appearing anymore on the edit post view, and basically I cannot add new translations to the default language.
I believe this side effect bug appeared after updating WPML as before everything seemed to work just fine.
I did further tests and yes, I see when the workaround is applied the translation connection between the original and translated post is lost.
I have forwarded the results of the test to our 2'nd tier team. Let's wait for their fix.
As for the final fix, our development team is still on it and we don't have an ETA yet. I will update you here as soon as we have an update from our 2'nd tier and/or development team.