Hi,
I’m trying to get the content of a flexible field before saving it into the database.
to do that I’m using the following filter:
function check_flexible_fields( $value, $postid, $field ) {
error_log( print_r($value,true) );
return $value;
}
add_filter('acf/update_value/name=my_flexible_field', 'check_flexible_fields', 10, 3);
the error_log
function prints only the following text:
Array
(
[0] => my_custom_layout
[1] => my_custom_layout
)
where my_custom_layout is one layout that I’ve created inside the Flexible content field.
BUT, if I use the following filter:
function check_flexible_fields( $value, $postid, $field ) {
error_log( print_r($value,true) );
return $value;
}
add_filter('acf/update_value/type=flexible_content', 'check_flexible_fields', 10, 3);
Array
(
[0] => Array
(
[acf_fc_layout] => my_custom_layout
[field_56b8858daea60] => 8064
[field_56b890cf7048c] => 'image1.jpg'
)
[1] => Array
(
[acf_fc_layout] => my_custom_layout
[field_56b8858daea60] => 8301
[field_56b890cf7048c] => 'image2.jpg'
)
)
I’m missing something or there is a problem retrieving flexible content values when using the first filter?
Thanks in advance