Don’t Trash Child Entries

By default, Nested Forms will trash child entries when the parent entry is trashed. Use this snippet to prevent this default behavior.

Instructions

Code

Filename: gpnf-do-not-trash-child-entries.php

<?php
/**
 * Gravity Perks // Nested Forms // Don't Trash Child Entries
 * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
 *
 * Instruction Video: https://www.loom.com/share/d35a8611240c4be085019b8e4c5bbac7
 *
 * By default, Nested Forms will trash child entries when the parent entry is trashed. Use this snippet to prevent this
 * default behavior.
 */
add_action( 'init', function() {
	if ( is_callable( 'gp_nested_forms' ) ) {
		remove_action( 'gform_delete_entry', array( gp_nested_forms(), 'child_entry_delete' ) );
		remove_action( 'gform_update_status', array( gp_nested_forms(), 'child_entry_trash_manage' ) );
	}
}, 16 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.