Following up on our recent WhatsApp conversation:
We identified that the issue came from a plugin generating pages without setting the global $post
variable.
This omission prevents the Language Switcher from retrieving the post ID.
For others encountering this problem, a workaround involves passing the post ID to the Language Switcher via a custom script, as demonstrated below:
add_action('lsw_get_current_post_id',function($post_id){
// fetch the custom post id here
return $post_id;
},999999,1);