include/exclude sync of AFC Repeater Fields
-
Hi all
i use polylang ( great plugin π ) with Advanced Custom Fields.
The syncing of the custom fields works perfect and as excepted. (if i toggle customfield syncing in the polylang settings on/off).Now i was looking for a way to choose wich custom fields should be synced and wich shouldn’t. When i turn custom field sync to off and add this Filter to functions.php. A single Field is synced.
add_filter('pll_copy_post_metas', 'copy_post_metas'); function copy_post_metas($metas) { return array_merge($metas, array('single field')); }So far so good. Now, if i want to sync a custom field wich is based on
an ACF Repeater (i.e. my Gallery), the above code seems not to work.I also tried the other way, by enabling custom field sync in polylang settings. (works with the ACF Repeater Gallery) and adding a code wich i found here, to remove the syncing of a field.
add_filter('pll_copy_post_metas', 'copy_post_metas'); function copy_post_metas($metas) { return array_splice($metas, array('my_slider_caption')); }That don’t work and i get following error while Saving a page:
Warning: array_splice() expects parameter 2 to be long, array given in .../functions.php on line 134 Warning: array_unique() expects parameter 1 to be array, null given in .../admin-sync.php on line 124 Warning: Invalid argument supplied for foreach() in .../admin-sync.php on line 127 Warning: array_splice() expects parameter 2 to be long, array given in .../functions.php on line 134 Warning: array_unique() expects parameter 1 to be array, null given in .../admin-sync.php on line 124 Warning: Invalid argument supplied for foreach() in .../admin-sync.php on line 127 Warning: Cannot modify header information - headers already sent by (output started at .../functions.php:134) in .../post.php on line 233 Warning: Cannot modify header information - headers already sent by (output started at .../functions.php:134) in .../wp-includes/pluggable.php on line 1179Is there a way to add sync of the acf repeater field by code?
or is there a way to exclude certain custom fields from syncing?Thanks in Advice!
Pixmeister
The topic ‘include/exclude sync of AFC Repeater Fields’ is closed to new replies.