pll_get_post($id, $lang) always return false (but trans is)
-
I use last version WP, ACF & Polylang plugins.
I have custom post type user_profile (‘ru’ & ‘en’).
Polylang settings are: https://prntscr.com/ba5avn
I set wpml-config.xml settings for my post & ACF custom fields (‘translate’ & ‘copy’).All working good. But…
When I create the translation of post and save it, I want to do some posts sync (they status & other).
I tried to use pll_get_post($id, $lang) in hooks ‘save_post’ (first hook) & ‘acf/save_post’ (next hook), but it returned always false. Why?It returned ‘false’, but I see in the Debuger:
$_POST[‘post_tr_lang’][‘en’] = ‘248’Look at, please: https://prntscr.com/ba4vtl
I try to google & read Docs, but nothing. I need help!
The questions:
1) When Polylang save all lang info?
2) Is maybe some hook like ‘pll_save’? Some other key hooks?
3) Where must I do my sync actions?In general, I don’t understand clear steps of algorithm/hooks ‘save post: WP->ACF->Polylang’ & where I can change my post safe (after all Polylang’s actions).
P.S. If I use wp_update_post() in ‘save_post’ & ‘acf/save_post’ I get broken translations links and unexpected changes language of the post. I think it’s all connected.
- The topic ‘pll_get_post($id, $lang) always return false (but trans is)’ is closed to new replies.