Docs & Support

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

frm_success_filter

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 hook can be used to manipulate a form's success message.

Usage

add_filter('frm_success_filter', 'change_my_confirmation_method', 10, 2);

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

Parameters

  • $type (array | string): An array of Confirmation actions, supported since Formidable Forms v6.0. If an empty array is returned, the default success message will be used. Possible return values are: message, redirect, or page.
  • $form (object)
  • $action (string): Used to check if this filter is running when creating or updating an entry. Possible values are: create or update.

Examples

Force Success Message on Update

Edit

This example will always show the success message when an entry is updated, even if the setting tells the form to redirect.

add_filter('frm_success_filter', 'change_my_confirmation_method', 10, 2);
function change_my_confirmation_method( $type, $form ) {
if ( $form->id == 5 && isset( $_POST ) && isset( $_POST['frm_action'] ) && $_POST['frm_action'] == 'update' ) { //change 5 to the ID of your form
$type = 'message';
}
return $type;
}

Force Success Message and Change Message

Edit

The example below will force a success message and set the message to "The form has been received."

add_filter('frm_success_filter', 'force_change_success_message', 10, 2);
function force_change_success_message( $type, $form ) {
if ( $form->id == 5 && isset( $_POST ) && isset( $_POST['frm_action'] )) { //change 5 to the ID of your form
$type = 'message';
$form->options['success_msg'] = "The form has been received.";
}
return $type;
}

Prevent redirect action when updating entry

Edit

Use this code example to check if there is any redirect action. If there is any, remove the redirect action when updating an entry.

add_filter('frm_success_filter', 'prevent_redirect_action' , 10, 2);
function prevent_redirect_action( $type, $form, $action ) {
if ( $form->id != 5 || 'update' != $action ) {
return $type;
}

if ( 'redirect' == $type ) {
return 'message';
}

if ( is_array( $type ) ) {
foreach ( $type as $index => $conf_action ) {
if ( 'redirect' == FrmOnSubmitHelper::get_action_type( $conf_action ) ) {
unset( $type[ $index ] );
}
}
}
return $type;
}

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