Skip Navigation

[Resolved] how to delete child and child of child when deleting parent

This support ticket is created 5 years, 7 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 5 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1264407

I have 3 post types (Program, Visit, Details).

Program is a parent to Visit.
Visit is a parent to Details.

When I delete a Program, I want all the child Visits and child Details to be deleted also.

How can this be done automatically?

Thanks,
Amin

#1264467

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Amin,

Thank you for contacting our support forum.

Unfortunately the only thing that can be automatically deleted is the intermediary post that is attached in the relationship.

You are not able to automatically delete the child posts in a relationship.

Thanks,
Shane

#1265299

Thanks Shane. Is there no extra code that can be added to accomplish this?

#1265847

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Amin,

I did a quick search in our forum for similar solutions and Was able to find this.
https://toolset.com/forums/topic/moving-child-posts-to-trash-upon-parent-is-sent-to-trash/

You can try following the instructions in the post below and see if this is able to help in your case.

Thanks,
Shane