47. Security Best Practices | Form Forge - Build Forms with AI in Seconds
Download Log in

47. Security Best Practices

Developer Guide

Security measures built into Form Forge and recommendations for developers extending it.

Input Sanitization

Every submitted field value is sanitized through FORMFORGE_Field_Types::sanitize() which applies type-specific sanitization:

Field TypeSanitization Function
text, passwordsanitize_text_field()
emailsanitize_email()
urlesc_url_raw()
textareasanitize_textarea_field()
number, range, ratingabsint() or floatval()
html_blockwp_kses_post()
All otherssanitize_text_field()

Nonce Verification

Every form submission verifies a WordPress nonce to prevent CSRF attacks:

php
check_ajax_referer( 'formforge_nonce', 'nonce' );

SQL Injection Prevention

All database queries use $wpdb->prepare() with parameterized placeholders:

php
$wpdb->get_results( $wpdb->prepare(
    "SELECT * FROM {$table} WHERE form_id = %d AND status = %s",
    $form_id, 'new'
) );

XSS Prevention

All output uses WordPress escaping functions:

php
esc_html( $field['label'] );
esc_attr( $field['id'] );
esc_url( $file_url );
wp_kses_post( $html_content );

Capability Checks

Admin endpoints verify manage_options capability. Public endpoints (submission, templates) have appropriate access controls.

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