Developer Hooks, Actions & API Reference
Customize form lifecycle execution, hook into submission events, sanitize custom inputs, and integrate with external CRM systems using native WordPress hooks.
1. Official Shortcode Integration
Diviniket WP Forms can be embedded into any WordPress post, page, widget, or page builder template using the clean shortcode syntax:
You can also execute the shortcode programmatically within your WordPress theme template files using PHP:
2. Core PHP Action Hooks
Tap into the submission lifecycle to trigger custom logic, send custom webhook requests, or update user meta:
divismfo_before_submission– Fires immediately before processing and validation begins. Useful for custom pre-submission checks.divismfo_after_submission– Fires after a form has passed validation and entries are saved to the database. Receives$entry_id,$form_id, and$form_dataarrays.divismfo_entry_created– Fires right after an entry row is inserted intowp_divismfo_entries.
3. Custom Action Hook Example
function custom_agency_lead_sync($entry_id, $form_id, $form_data) {
if ($form_id === 12) {
$email = sanitize_email($form_data['email']);
$name = sanitize_text_field($form_data['name']);
wp_remote_post('https://api.yourcrm.com/v1/leads', [
'body' => json_encode(['email' => $email, 'name' => $name]),
'headers' => ['Content-Type' => 'application/json']
]);
}
}
4. Frontend JavaScript Events
Listen to client-side DOM events dispatched by Diviniket WP Forms for custom analytics tracking or modal triggers:
const formId = e.detail.formId;
if (typeof gtag === 'function') {
gtag('event', 'generate_lead', { form_id: formId });
}
});