gform_delete_lead

Description

Note: This hook has been deprecated and gform_delete_entry should be used instead.

Fires right before an entry is deleted. Use this hook to perform actions when an entry is deleted.

Usage

add_action( 'gform_delete_lead', 'delete_entry_post' );

Parameters

  • $entry_id integerThe ID of the entry that is about to be deleted.

Examples

This example deletes the post associated with the deleted entry.

add_action( 'gform_delete_lead', 'delete_entry_post' );
function delete_entry_post( $entry_id ) {

//getting entry object
$entry = GFAPI::get_entry( $entry_id );

//if entry is associated with a post, delete it
if ( isset( $entry['post_id'] ) ) {
wp_delete_post( $entry['post_id'] );
}
}

Source Code

This filter is located in GFFormsModel::delete_lead() in forms_model.php.