This post is to help people encountering this bug. I found a fix for my case.
I’m using :
– ACF Pro 5.8
– WordPress 5.1.1
– Timber library 1.9.4
Bug description : ACF Block with a repeater field inside, it works saving values and values can be displayed but the default ACF logic does not retrieve the values at all in the admin form. Which makes your repeater fields look empty.
If you want more details about the bug origin in the code you can ask.
So I added this piece of code in my functions.php file :
* This filter is used to inject preview value.
* Added params because there's no documentation for the "acf/pre_load_value" filter yet.
* @param $value (mixed) the value found in the database
* @param $post_id (mixed) the $post_id from which the value was loaded
* @param $field (array) the field array holding all the field options
* @return $value
function wm_fix_repeater_gutenberg( $value, $post_id, $field )
// Conditional field type here because it's not available in the filter name
// For now I only saw a bug with repeater field
if ($field['type'] != 'repeater') return $value;
// We must preload the value before ACF checks it so we avoid the default ACF logic which breaks the value.
$value = acf_get_metadata( $post_id, $field['name'] );
add_filter('acf/pre_load_value', 'wm_fix_repeater_gutenberg', 10, 3);
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users