Shortcode & Gutenberg Block
Shortcode
[oforms id="5"]
[oforms id="5" title="false" description="false"]
Attributes
| Attribute | Default | Description |
|---|---|---|
id | required | Form ID |
title | true | Show form title |
description | true | Show form description |
class | "" | CSS class added to wrapper <div> |
Gutenberg Block
OForms registers an Embed Form block. Select a form from the dropdown in the block inspector. The form renders server-side (no JavaScript required until field interactions start).
PHP: Render Programmatically
phpecho OForms\Core\Shortcode::render_form( $form_id, [
'title' => false,
'description' => false,
'class' => 'my-contact-form',
]);
AJAX Submit
Forms submit via AJAX by default. The endpoint is:
POST /wp-admin/admin-ajax.php
action=of_submit
form_id=5
nonce=<nonce>
fields[email]=user@example.com
fields[message]=Hello
Response:
json{ "success": true, "entry_id": 42, "redirect": null, "message": "Thank you!" }