1. Getting Started | Form Forge - Build Forms with AI in Seconds
Download Log in

1. Getting Started

Developer Guide

Shared Forge Suite Diagnostics

When Form Forge is active, the shared Forge Suite > Setup & Health panel is available in WordPress admin. The diagnostic AJAX action is forge_suite_health_check; the guided-action endpoint is forge_suite_health_repair. Both require manage_options and the localized forge_suite_health_check nonce. The response returns diagnostics for active Forge plugins, local license records, credits widget readiness, Avakode API /health, permalinks, migration/integration source plugins, recommendations, and recent run history. Allowed repair actions are narrow: refresh permalink rules, refresh saved credit balances, generate a redacted support package, or clear diagnostic history. The panel does not submit forms, call AI endpoints, spend credits, send webhooks, write integration settings, or change license/Freemius state.

Embedding a Form Programmatically

The simplest way to render a Form Forge form in a theme template is with do_shortcode():

php
// In any template file (single.php, page.php, sidebar.php, etc.)
echo do_shortcode( '

Form not found.

' );

If you need the renderer directly (e.g., in a widget or custom block):

php
// Direct renderer call — returns HTML string
$html = FORMFORGE_Form_Renderer::instance()->render( 42 );
echo $html;

You can also render forms inside custom page templates by passing the form ID from a template variable or ACF field:

php
// In a custom page template using ACF
$form_id = get_field( 'contact_form_id' );
if ( $form_id ) {
    echo FORMFORGE_Form_Renderer::instance()->render( (int) $form_id );
}

Checking if the Plugin is Active

Before calling any Form Forge API, always verify the plugin is loaded. This prevents fatal errors when your theme or plugin is used on sites without Form Forge:

php
if ( class_exists( 'FORMFORGE_Core' ) ) {
    // Form Forge is active — safe to call its APIs
    $forms = FORMFORGE_Form_Builder::instance()->get_all();
}

A more defensive pattern wraps all Form Forge calls in a helper function:

php
function my_theme_get_form( $form_id ) {
    if ( ! class_exists( 'FORMFORGE_Form_Renderer' ) ) {
        return '<p>Form plugin is not active.</p>';
    }
    return FORMFORGE_Form_Renderer::instance()->render( (int) $form_id );
}

Checking the License Plan

Use the license API to conditionally enable features in your theme or plugin based on the user’s Form Forge plan:

php
$license = FORMFORGE_License::instance();

if ( $license->is_pro() ) {
    // PRO or Trial plan — enable premium theme features
}

if ( $license->can( 'webhooks' ) ) {
    // Feature-level check — webhooks are available
}

// Available feature slugs:
// ai_generation, conditional_logic, webhooks, analytics,
// abandonment, submissions_ai, advanced_templates,
// advanced_antispam, file_uploads, multi_step, payment,
// unlimited_forms

Example: conditionally showing a file upload field only when the PRO plan supports it:

php
$license = FORMFORGE_License::instance();
$form = FORMFORGE_Form_Builder::instance()->get( 42 );

foreach ( $form->fields as $field ) {
    if ( $field['type'] === 'file_upload' && ! $license->can( 'file_uploads' ) ) {
        // Skip rendering this field on the Free plan
        continue;
    }
    echo FORMFORGE_Field_Types::render( $field );
}

Constants

These constants are defined when the plugin loads and are available throughout the WordPress lifecycle:

ConstantValueDescription
FORMFORGE_VERSION'1.0.0'Plugin version string
FORMFORGE_DIRPlugin directory pathAbsolute filesystem path with trailing slash
FORMFORGE_URLPlugin directory URLFull URL with trailing slash
FORMFORGE_BASENAME'formforge/formforge.php'Plugin basename for hooks

Using constants in your code:

php
// Load a template from Form Forge's directory
include FORMFORGE_DIR . 'templates/custom-layout.php';

// Enqueue a script that depends on Form Forge frontend JS
wp_enqueue_script(
    'my-form-addon',
    get_template_directory_uri() . '/js/form-addon.js',
    [ 'formforge-frontend' ],
    FORMFORGE_VERSION,
    true
);

// Check the plugin version before using a newer API
if ( defined( 'FORMFORGE_VERSION' ) && version_compare( FORMFORGE_VERSION, '1.2.0', '>=' ) ) {
    // Use a feature introduced in 1.2.0
}

Plugin Lifecycle Hooks

Form Forge fires standard WordPress activation and deactivation hooks that you can tap into:

php
// Run code when Form Forge is activated
register_activation_hook( WP_PLUGIN_DIR . '/' . FORMFORGE_BASENAME, function() {
    // Create your custom tables or options that depend on Form Forge
} );

// Run code after Form Forge is fully loaded
add_action( 'plugins_loaded', function() {
    if ( ! class_exists( 'FORMFORGE_Core' ) ) {
        return;
    }
    // Safe to register custom field types, hooks, etc.
}, 20 ); // Priority 20 ensures Form Forge has loaded at priority 10

Forge AI Assistant Online

Hi! I'm the Form Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs