Skip to main content
Version: Divi 5

Developer Hooks

What do hooks do?

Divi Form Builder lets you build custom forms and extend behavior with PHP actions and filters. Use these hooks to integrate with APIs, modify submitted data, customize emails, and run logic before or after form processing.

Common extension points (start here)

  • Before processing: df_before_process for pre-submit checks or logging.
  • After processing: df_after_process for integrations and automation.
  • Post workflows: df_before_insert_post and df_after_insert_post.
  • User workflows: df_before_insert_user and df_after_insert_user.
  • Email output: df_contact_body filter to customize outbound content.

Quick example

add_action( 'df_after_process', function( $form_id, $post_array, $form_type ) {
// Example: send data to a CRM endpoint.
// wp_remote_post( ... );
}, 10, 3 );

Actions

df_before_process

do_action( 'df_before_process', $form_id, $post_array, $form_type )

Description: Fires after the form is submitted and captcha validation has passed.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_array: (Array) Submitted fields. Keys are mapped field names or custom field names when Field Mapping Type is Custom.
  • $form_type: (String) Form type.

df_before_insert_post

do_action( 'df_before_insert_post', $form_id, $post_array )

Description: Fires before creating a new post. For Post/Product and CPT forms only.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_array: (Array) Processed form data for the post. See $postarr in wp_insert_post().

df_after_insert_post

do_action( 'df_after_insert_post', $form_id, $post_id, $post_array )

Description: Fires after a new post has been inserted or an existing post updated.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_id: (int) ID of the post inserted or updated.
  • $post_array: (Array) Data used to update or insert the post.

df_before_insert_user

do_action( 'df_before_insert_user', $form_id, $post_array )

Description: Fires before creating or updating a user. For user registration/edit forms.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_array: (Array) User data. See $userdata in wp_insert_user().

df_after_insert_user

do_action( 'df_after_insert_user', $form_id, $user_id, $post_array )

Description: Fires after a user has been inserted or updated.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $user_id: (int) ID of the user inserted or updated.
  • $post_array: (Array) User data used to update or insert.

Note: user_pass in the array is raw for insert and encrypted for edit user forms.

df_process_uploaded_files

do_action( 'df_process_uploaded_files', $form_id, $uploaded_files, $form_type )

Description: Fires after all files have been uploaded via the form.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $uploaded_files: (Array) URLs of uploaded files.
  • $form_type: (String) Form type.

df_after_process

do_action( 'df_after_process', $form_id, $post_array, $form_type )

Description: Fires after captcha check and form processing are complete.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_array: (Array) Submitted/processed parameters.
  • $form_type: (String) Form type.

df_captcha_failed

do_action( 'df_captcha_failed', $form_id, $post_array, $form_type )

Description: Fires when captcha validation fails.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $post_array: (Array) Submitted parameters.
  • $form_type: (String) Form type.

df_before_redirect

do_action( 'df_before_redirect', $form_id, $submit_result, $redirect_url )

Description: Fires before redirecting after form submission.

Parameters:

  • $form_id: (String) Form ID from the Form setting.
  • $submit_result: (String) 'success' or 'failed'.
  • $redirect_url: (String) URL used for redirect.

de_fb_before_form_render

do_action( 'de_fb_before_form_render' )

Description: Fires before the form is rendered. No parameters.

Filters

df_contact_body

apply_filters( 'df_contact_body', $body, $post_array )

Description: Filters the email body content.

Parameters:

  • $body: (String) Generated HTML email body.
  • $post_array: (Array) Submitted form data.
note

We do not provide support for custom code that uses these hooks. If you find a bug in the hooks themselves, we can help. For custom functionality, we offer custom development services—contact us via the support channel.

What's Next

  • FAQ index - Check common runtime issues before writing custom hook logic.
  • Form settings - Confirm core behavior through module settings first.
  • Form module reference - Review module configuration that affects hook payloads.