Creating & Configuring Forms
Forms are managed under OForms → Forms in WP admin.
Form Settings
| Setting | Description |
|---|---|
| Title | Internal name (not shown on frontend) |
| Submit Button Label | Defaults to "Submit" |
| Success Action | Show message, redirect to URL, or reload page |
| Success Message | HTML shown after successful submission |
| Redirect URL | Used when success action is "redirect" |
| Store Entries | Whether to save submissions to the database (default: on) |
| CAPTCHA | Enable honeypot or Google reCAPTCHA v3 |
PHP API
php// Get a form by ID
$form = OForms\Forms\Form::get( $form_id );
// Get all published forms
$forms = OForms\Forms\Form::get_all();
// Get form schema (fields array)
$schema = $form->get_fields(); // returns array of field configs
// Programmatically submit a form
$result = OForms\Forms\Submission::process( $form_id, $field_values );
// Returns: WP_Error on failure, entry_id (int) on success
Hooks
php// Before submission is processed
add_action( 'of_before_submit', function( int $form_id, array $values ) {} );
// After successful submission
add_action( 'of_after_submit', function( int $form_id, int $entry_id, array $values ) {} );
// Filter values before saving entry
add_filter( 'of_submit_values', function( array $values, int $form_id ): array {
return $values;
}, 10, 2 );