Add it to your Toolset custom code settings in Toolset->Settings->Custom Code. Ensure that you have activated it.
Next you will need to replace 'persoon' with the Parent Post type and "relatie_personen_phvs" with the post relationship slug.
This will ensure that the child posts are deleted when the parent is deleted.
Finally this will only work if the action of the toolset delete button is set to 'delete'. This will not work when it is set to 'trash'
This support ticket is created Il y a 3 années et 1 mois. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Also I've added the delete button back at the bottom of the page as a test and it works. What you can do is to setup a sample post on your end with a few children and test to see if you get it to work as well.
I created a parent post and some children posts and tried to delete them with the delete button on the parent edit form, but the children are still there. So it's not working for me.
Hello Shane, I use a delete button on the edit form for the person. The delete button on the post it self is working and is deleting the child posts.
So at the top of the post there is a button Bewerken to edit the person. At the bottom of this form is the delete button I want to use. This one has exactly the same shortcode and parameters but is only removing the parent, not the children.
From my previous post I mentioned that I had to change the action from trashing the post to delete the post.
Currently on the form you have this.
action='trash'
However what is required is action='delete'. The hook "before_delete_post" doesn't work for when a post is being trashed. This hook only fires when the post is deleted directly.
Changing your action to delete should solve the issue.
Please let me know if this clarifies the issue for you.
Only the deleting of the posts will fire the hook so that you can delete the child posts as well. This is a limitation of wordpress and not our plugins themselves since we are piggy backing on their hook to get this done.
SO the only way to get this to work is to delete the posts rather than trashing them.