WP Hook

WP Hook is a custom form action that acts as a callback to an action hook of your choice. You can use the WP Hook action instead of writing a full custom function of your own.

To see these features you will need to enable Developer Mode in Ninja Forms settings.

Using the WP Hook Action

The action is found on the Emails and Action tab of the form builder. Developer Mode must be enabled. To add the action to any form, click Add New Action and then the WP Hook action from inside the Actions Window that opens.

image of the Emails and Actions tab of the form builder with Add New action and the WP Hook action highlighted within the actions window

The action will now appear in the list. Click WP Hook to open its settings window.

The Hook Tag setting is where you can specify what WordPress action hook (stock or custom) to call.

The callback will trigger on form submission only. The callback cannot update the submitted form data as this is a WordPress action and not a filter.

During submission the specified Hook Tag is passed a $form_data array variable. This array contains the form id, form fields, and form settings data as top level keys in the array.

What are hooks?
If you’d like to learn more about hooks the WordPress Developer Resources explain them in detail.

Was this article helpful?

Related articles: