Tell us what you are trying to do?
By cred form need to get value of parent post field : wpcf-glavanastavnika
and put it in the field of child post : wpcf-glavamiu
relationship : miuonline_volshebniki
add_action('cred_save_data', 'plus_one_glava_diu_miu_dc',10,2);
function plus_one_glava_diu_miu_dc ($post_id, $form_data)
{
// Execute for form ID: 123
if ($form_data['id'] == 16709 ) {
// Custom field name
$mmeta_key = "wpcf-glavamiu";
// Get value from parent MIU field
global $post;
$parent_post = $post->ID;
$field_slug = 'miuonline_volshebniki';
$get_results = toolset_get_related_posts( $parent_post, $field_slug, 'parent', 1000, 0, array(), 'post_id','child');
$parent_glavamiu = types_render_field( 'wpcf-glavanastavnika', array( 'item' => $get_results) );
// Finally, update $meta_key for $user_id with $newValue
update_post_meta( $post_id, $mmeta_key, $parent_glavamiu);
}
}
Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
Is there a similar example that we can see?
https://toolset.com/forums/topic/how-to-get-value-of-a-field-from-a-custom-post-with-parent-post-reference-field/
What is the link to your site?