Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Last active December 13, 2024 04:02
Show Gist options
  • Save andrewjmead/a5ba8d613c90a800656ca74d015d5950 to your computer and use it in GitHub Desktop.
Save andrewjmead/a5ba8d613c90a800656ca74d015d5950 to your computer and use it in GitHub Desktop.
JetFormBuilder form submission hook for WordPress
<?php
/**
* JetFormBuilder has no documentation about what hooks they fire or when they fire them.
*
* I ended up digging into their source code to try and find an action that fires for all
* form submission, even if they don't have a custom "post submit action" set up.
*
* Using jet-form-builder/form-handler/after-send gets the job done.
*/
add_action('jet-form-builder/form-handler/after-send', function ($form) {
if (!$form->is_success) {
return;
}
$form_id = intval($form->form_id);
$post = get_post($form_id);
if (is_null($post)) {
return;
}
$form_title = $post->post_title
// Success!
// Do something with form_id and form_title and other data on form...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment