Skip Navigation

[Resolved] Set a child post title from parent post title

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by antonK-2 3 years, 10 months ago.

Author
Posts
#1898663

Tell us what you are trying to do?

Empty title value coming from parent post and date from field wpcf-data_raskrytiya is coming as strange number (not date).

CODE:

add_action('cred_save_data', 'your_save_data_action',10,2);
function your_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==1967)
{
$docyear = get_post_meta($post_id, 'wpcf-data_raskrytiya', true);
$custname = isset($_POST['@khrustalnyi_shar_parent']) ? get_the_title($_POST['@khrustalnyi_shar_parent']) : '';

$drdetail= $docyear. ' - ' . $custname. ' - ' ;
$args = array('ID' => $post_id, 'post_title' => $drdetail);
wp_update_post($args);
}
}

Is there any documentation that you are following?
https://toolset.com/forums/topic/set-a-relational-post-title-with-code/

Is there a similar example that we can see?

What is the link to your site?

#1898691

Important that there should be relationship slug NOT parent slug of the post.