I'm trying to separate values with a comma within a custom field so that the plugin I use from filters can separate them.
The custom field is called 'sub_ubicacion_norte'
.
The values are for example in a post: "San Isidro, Vicente Lopez, Pilar".
Now in the filter I get "San Isidro, Vicente Lopez, Pilar" as a single option and I want it to be three in this case.
The code I am embedding in functions.php
is:
function my_acf_update_norte1( $value, $post_id, $field) {
$field1 = get_field('sub_ubicacion_norte');
var_dump($field1);
$norte1 = substr($field1, 0,1);
var_dump($norte1);
return $norte1;
}
add_filter('acf/update_value/name=sub_ubicacion_norte','my_acf_update_norte1', 10, 3);
function my_acf_update_norte2( $value, $post_id, $field) {
$field2 = get_field('sub_ubicacion_norte');
var_dump($field2);
$norte2 = substr($field2, 1,2);
var_dump($norte2);
return $norte2;
}
add_filter('acf/update_value/name=sub_ubicacion_norte','my_acf_update_norte2', 10, 3);