Gform delete lead

Description

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

Usage

<?php
add_action("gform_delete_lead", "delete_entry_post");
?>

Parameters

$entry_id
(int) The ID of the entry that is about to be deleted.

Examples

This example deletes the post associated with the deleted entry

<?php

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

    //getting entry object
    $entry = RGFormsModel::get_lead($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 forms_model.php

Search the Documentation