Polylang: selective pll_copy_post_metas?
-
I have a site with two custom Post types, created in Pods, but now switched over to hardcoded CPT and taxonomy creation and ACF Pro for the Custom fields.
What I’m trying to do is to tell Polylang to copy some custom fields and to synchronize the other custom fields.
For example:
copy event_description, so that an events’ programme can be displayed in english as well as german.
synchronize event_date, since that’s never going to be different in any language.I added this code to my custom plugin:
add_filter('pll_copy_post_metas', 'copy_post_metas'); function copy_post_metas($metas) { return array_splice($metas, array('event_description')); } add_filter('pll_copy_post_metas', 'merge_post_metas'); function merge_post_metas($metas) { return array_merge($metas, array('event_date')); }
but now Polylang simply creates translations with empty custom fields. Nothing is copied, nothing is synchronized.
What am I doing wrong?
Thanks for any insight!(BTW, the Polylang filter reference is a bit opaque, at least to non-programmers, IMHO. What’s the $sync argument, where does it appear if at all?)
Permalinks: /sample-post/
Static Front Page: yes
Polylang settings: 2 languages, Synchronization: Custom fields ON
- The topic ‘Polylang: selective pll_copy_post_metas?’ is closed to new replies.