Find out current language in post-new.php
-
Hi!
I was wondering if there was a way to find out the language of a post in post-new.php that hasn’t been saved and thus has no ID. At this point global $post object has no ID (and is in fact null). This is problematic because the Polylang functions that return the current language require this ID.
In theory, an automatic draft is created as soon as post-new.php is opened but to my knowledge there is no way to get the ID of this auto-draft.
Is there some function I am missing or is this just not possible? I need the language in PHP as I’m building some logic that would need the current language. In existing post I could easily just get the ID of the post and get language from there.
- The topic ‘Find out current language in post-new.php’ is closed to new replies.