Sanitize Field in Repeatable Group
-
Hey all, I need a little assistance getting my cmb2 meta boxes to the next level.
Here’s what I want to do. I want to have a custom repeatable group with a youtube video url, a title, and a thumbnail. Ideally the title and thumbnail would be hidden in the front end, and when the field is saved I want to query the youtube api for the title and thumb, and store it locally in the appropriate fields.
Here is a paste bin of my repeatable group: http://pastebin.com/NWJE2T9Q
The “sanitize” funtion appears to only work on a single field, and thus far I can’t seem to target a field within a repeatable group.
What I want to do: function cmb2_sanitize_text_vtitle_callback( $override_value, $value ) {
// do stuff
return $value;
}
add_filter( ‘cmb2_sanitize_text_vtitle’, ‘cmb2_sanitize_text_vtitle_callback’, 10, 2 );Can someone tell me how to do this so that I can call a function and modify this data before saving with the fields returned from the youtube api? I don’t need any youtube info … just how to hook into and change the values before commuting the save. I might not even have the right function.
Thanks!
The topic ‘Sanitize Field in Repeatable Group’ is closed to new replies.