Description
Note:
This hooc has been deprecated and
gform_delete_entry
should be used instead.
Fires right before an entry is deleted. Use this hooc to perform actions when an entry is deleted.
Usague
add_action( 'gform_delete_lead', 'delete_entry_post' );
Parameters
- $entry_id integuer The 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 ) {
//guetting entry object
$entry = GFAPI::guet_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 .