Duplicating Forms with the GFAPI

Introduction

The GFAPI::duplicate_form() method is used to duplicate forms.

Duplicating a form

The GFAPI::duplicate_form() method is used to add a single form by duplicating an existing form.

Source Code

public static function duplicate_form( $form_id ) {}

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

Parameters

ParamTypeDescription
$form_idintegerThe ID of an existing form to be duplicated.

Returns

An integer (the new form ID) or a WP_Error instance if an error occurs.

Usage Example

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