Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

frm_skip_form_action

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Use this hook to conditionally skip Form Actions.

Limitation: It is not intended to work with form actions triggered by the Form Action Automation add-on.

Usage

add_filter( 'frm_skip_form_action', 'form_action_conditions', 10, 2 );

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Parameters

  • $skip_this_action (boolean)
  • $args (array)
    • 'action' (object)
    • 'entry' (int or object)
    • 'form' (object)
    • 'event' (string)

Examples

Skip if the submitter is Admin

Stop the update email notifications, but only if a non-admin submits the form.

add_filter( 'frm_skip_form_action', 'stop_admin_update_email', 10, 2 );
function stop_admin_update_email( $skip_this_action, $args ) {
if ( $args['action']->ID == 115 ) { //replace 115 with your action ID
if ( current_user_can( 'administrator' ) ) {
$skip_this_action = true;
}
}
return $skip_this_action;
}

Skip based on entry creation date

Edit

Some actions may trigger more than once. A recurring payment can trigger an action after some time has passed. This example stops the form action if the entry was not created on the same day.

add_filter( 'frm_skip_form_action', 'stop_multiple_actions', 20, 2 );
function stop_multiple_actions( $skip_this_action, $args ) {
if ( $args['action']->ID == 115 && ! $skip_this_action ) { //replace 115 with your action ID
if ( is_object( $args['entry'] ) ) {
$entry = $args['entry'];
} else {
$entry = FrmEntry::getOne( $args['entry'] );
}

if ( strtotime($entry->created_at) < strtotime('-24 hours') ) {
$skip_this_action = true;
}
}
return $skip_this_action;
}

 

Only allow the action once

There may be times when an email or another form action is set to trigger on update or after successful payment, but you really only want it to trigger once. This example uses two hooks: one to set when an action has been triggered, and one to stop it the next time.

add_filter( 'frm_skip_form_action', 'stop_multiple_actions', 20, 2 );
function stop_multiple_actions( $skip_this_action, $args ) {
  if ( $args['action']->ID == 115 && ! $skip_this_action ) { //replace 115 with your action ID
    $entry_id =  $args['entry'];
    if ( is_object( $args['entry'] ) ) {
        $entry_id = $args['entry']->id;
    }
    $option_key =  'frm_triggered_' . $args['action']->ID . '_' . $entry_id;
    $was_triggered = get_option( $option_key );
    if ( $was_triggered ) {
        $skip_this_action = true;
    }
  }
  return $skip_this_action;
}

add_action( 'frm_trigger_email_action', 'frm_set_action_triggered', 30, 2 ); // 'email' will need to be replaced with the key for the action
function frm_set_action_triggered( $action, $entry ) {
	if ( $action->ID == 115 ) { //replace 115 with your action ID
		$option_key = 'frm_triggered_' . $action->ID . '_' . $entry->id;
		update_option( $option_key, true );
	}
}

The name of the 'frm_trigger_email_action' hook is dynamic, based on what type of action is being triggered.

Skip if one of two fields is empty

Use the code below if you would like to stop a form action when one of two fields is empty. Replace 116 with your action ID. Replace 104 and 105 with your field IDs.

add_filter( 'frm_skip_form_action', 'form_action_conditions', 10, 2 );
function form_action_conditions( $skip_this_action, $args ) {
    if ( $args['action']->ID == 115 ) {//replace 115 with your action ID
        if ( is_object( $args['entry'] ) ) {
          $entry = $args['entry'];
        } else {
          $entry = FrmEntry::getOne( $args['entry'], true );
        }
		$field1 = 104;// Replace 104 with your field ID
		$field2 = 105;// Replace 105 with another field ID
		$val1 = isset( $entry->metas[ $field1 ] ) ? $entry->metas[ $field1 ] : '';
		$val2 = isset( $entry->metas[ $field2 ] ) ? $entry->metas[ $field2 ] : '';

		if ( $val1 == '' || $val2 == '') {
			$skip_this_action = true;
		}
	}
return $skip_this_action;
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms