Skip Navigation

[Resolved] Save post title with parent post name

This thread is resolved. Here is a description of the problem and solution.

Save post title with parent post ID using Toolset form

You can use Toolset Form hook "cred_save_data" to update the post title on fly.

You can find the proposed solution, in this case, with the following reply:

Relevant Documentation:

This support ticket is created 3 years, 8 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 7 replies, has 2 voices.

Last updated by domenicoS 3 years, 8 months ago.

Assigned support staff: Minesh.



Hi trying to automatically set the post name when created with a cred form.

I tried this, but something does not works because it does not take me the Parent ID. What is wrong?

function func_custom_post_title($post_id,$form_data ) {
    if ($form_data['id']==4352) {
		$parent_id = toolset_get_related_post( $post_id, 'destination-who-s-who',  'parent');
        $title= $parent_id. '-' . $post_id ;
		wp_update_post(array('ID' => $post_id, 'post_title' => $title));

After saving the form I aspect to see a new post with the title: PARENTID-POSTID

relationship slug: destination-who-s-who



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - the code you shared looks just fine but why its not showing the desired title with the parent ID, I need to investigate that on your install.

Could you please share problem URL where you added the form?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I checked the access details you shared but unfortunately the access details you shared when I try to load the wp-admin link - it says "This site can’t be reached". I could not able to access the site.

Could you please make sure the site should work at this end so I can login to it.


Sorry, there was a http problem. I set the website in https, so you can now be able to access I hope.
Pleae update the like I shared with you adding https://



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now, I've adjust the code as given under:

function func_custom_post_title($post_id,$form_data ) {
    if ($form_data['id']==4352) {
		$parent_id = $_POST['@destination-who-s-who_parent'];
        $title= $parent_id. '-' . $post_id;
		wp_update_post(array('ID' => $post_id, 'post_title' => $title,'post_name' => $title));

I can see its displaying current parent ID and child ID information.


My issue is resolved now. Thank you Minesh!


Hi Minesh,

I checked the page. The title is correct, but not the link because it contains the classic "cred slug" (cred-auto-draft-3c9bece90c3091f58a531b75bfb77508-5) and not the title slug


My issue is resolved now. Thank you!

I use this code

wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'post_name' => $title));