I am using a PHP snippet that I’ve dropped in Code Snippets to create child entries when a parent form is submitted. It works well for what I am trying to accomplish. I have been trying to create another snippet that deletes the child entries when the parent entry is deleted, but have not had any success. I tried to delete the entries by telling it to delete child entries with the parent ID of the form that was just deleted and then I tried it using the Unique ID, and neither of those attempts worked. If you all could help me out with whipping up a snippet that works to accomplish this task, that would be amazing. Thank you in advance. The forms are deleted using Gravity View, if that changes anything.
Hi Witt,
By default, when a parent entry is deleted, the associated child entries are also deleted. I suspect the issue has to do with the snippet you’re using to programmatically create the child entries. It could be the created child entries are not properly linked to the parent entry, which is why they are not deleted when the parent entry is deleted.
To properly troubleshoot this, we’ll have to review the snippet to confirm if it’s correctly creating the child entries. I suggest you get in touch with us via our support form, so we can have a closer look at your setup.
Best,