Deleting Forms with the GFAPI

Introduction

The GFAPI::delete_form() and GFAPI::delete_forms() methods are used to delete forms.

Deleting a single form

The GFAPI::delete_form() method is used to delete a single form.

Source Code

public static function delete_form( $form_id ) {}

This method is located in /includes/api.php.

Parameters

ParamTypeDescription
$form_idintegerThe ID of the form to be deleted.

Returns

Boolean, true on success, or a WP_Error instance if an error occurs.

Usage Example

$result = GFAPI::delete_form( $form_id );

Deleting multiple forms

The GFAPI::delete_forms() method is used to delete multiple forms.

Source Code

public static function delete_forms( $form_ids ) {}

This method is located in /includes/api.php.

Parameters

ParamTypeDescription
$form_idsinteger[]An array containing the IDs of the forms to be deleted.

Returns

This method does not return a result.

Usage Example

GFAPI::delete_forms( array( $form_1_id, $form_2_id ) );