Background of the issue:
I am trying to address a SEO-related bug in the WPML plugin's language handling. The issue occurs when a published post in Italian has a corresponding English post in draft status. When visiting the published Italian post's URL in incognito mode, an alternate language link is generated for the draft English post, which should not occur due to SEO considerations. The issue likely originates in the `head_langs()` function, where post status is not being correctly validated before generating alternate language links. I expected to see: Instead, I got:
Key Details:
- Primary Language: Italian
- Secondary Language: English
- Scenario: Published post in Italian, corresponding English post in draft status
- Problem: Alternate language link () appears for draft posts in page section
Symptoms:
An alternate language link is incorrectly generated for a draft English post when visiting the published Italian post's URL in incognito mode.
Questions:
How can I prevent alternate language links from being generated for draft posts?
Is there a way to modify the `head_langs()` function to correctly validate post status?
L'argomento “[Chiuso] Incorrect Alternate Language Link for Draft Posts” è chiuso a nuove risposte.