Run WordPress Hook Action – WS Form

Run WordPress HookPRO

The ‘Run WordPress Hook’ action runs a WordPress action or filter when a user saves or submits a form. Although simple this action is powerful and allows developers to run any PHP code when a website visitor submits a form.

Adding This Action

To add a ‘Run WordPress Hook’ action:

  1. When editing your form, click the ‘Actions’ icon at the top of the page. The ‘Actions’ sidebar will open on the right-hand side of the page.
  2. Click the ‘Add’  icon to add a new action.
  3. Select ‘Run WordPress Hook’ from the Action pulldown. A series of settings will appear.

As with all sidebars in WS Form, click the ‘Save’ button at the bottom to save your changes, or click ‘Cancel’ to disregard your changes.

The ‘Run WordPress Hooks’ action settings are as follows:

When should this action run?

You can choose to run the WordPress hook when the form is saved, submitted, or both.


Select the type of hook you would like to run:

  • Filter (apply_filter)
  • Action (do_action)

Hook Tag

Enter the tag name of the filter or action you want to run.

Writing Hooks


WS Form PRO will call the filter as follows:

apply_filters($tag_name, $form, $submit);

  • $form – This contains the form data.
  • $submit – This contains the submit data.

The return from your filter function will be processed as follows:

Return Type Processed As
$submit object $submit object will be replaced and passed to the next action
Integer (0 – 100) Spam level set
0 = Not spam, 100 = Spam
false Action processing halted


WS Form PRO will call the action as follows:

do_action($tag_name, $form, $submit);

  • $form – This contains the form data.
  • $submit – This contains the submit data.