Background of the issue:
I am trying to use the wpml_get_element_translations hook, but it is missing private posts when running in cron.
Symptoms:
I expected to see all translations, but instead, I got only public translations.
Questions:
Why is the wpml_get_element_translations hook missing private posts in cron?
How can I ensure all translations, including private posts, are retrieved?
and there is no way to set this to skip privilege checking with the filter
Also this code has an unintended side effect, that it will load the user too early, if the filter is used on plugins loaded hook for example.
The $skipPrivilegeChecking should be first in the condition, in case it's true it won't check current user can and therefore won't load the user too early
This issue has been escalated to our developers. For the upcoming release (4.7), we’ve already included a check for WP-CLI, and we will also add a check for cron jobs.