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.
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.
This filter hook allows triggering custom actions, and skipping the default trigger.
Parameters
- $skip (bool): Set to true to skip the default trigger.
- $action (object): Form action object.
- $entry (object): Entry object.
- $form (object): Form object.
- $event (string): Can be create or update .
Examples
Send an email to admin when an API action runs
add_filter( 'frm_custom_trigger_action', function ( $skip, $form_action, $entry, $form, $event ) {
if ( 'api' === $form_action->post_excerpt ) {
$content = 'Running API action for form ' . $form->name . ' with entry ' . $entry->id;
wp_mail( get_bloginfo( 'admin_email' ), 'API action notification', $content );
}
// Not skip the original action.
return $skip;
}, 10, 4 );