Docs & Support

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

Developer DocumentationAdd-on Hooks
frm_bulk_edit_after_revert_snapshot
Entries & ReportsEditing and Deleting Entries
frm_bulk_edit_after_revert_snapshot

frm_bulk_edit_after_revert_snapshot

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 third-party development.

Use the frm_bulk_edit_after_revert_snapshot action to run your own code after someone reverts a Bulk Edit snapshot. It passes the snapshot ID, the user who clicked Revert, and the number of entries that were restored.

Requirements

  • The Bulk Edit Entries add-on, a Boost that is sold separately. It needs Formidable Forms Pro with an active license.

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

How it works

Bulk Edit saves a snapshot of the affected entries before every bulk save. To open the Bulk Edit grid, go to Formidable → Entries and show the entries of 1 form. Next, check the entries and select Bulk edit in the Bulk Actions dropdown. Then click Apply. Learn more about how to open the bulk editor.

In the grid, click History next to the Bulk Edit Entries title. The History window lists the snapshots of the form, and each one has a Revert button. Learn more about how to undo a save.

A revert runs in this order:

  1. Bulk Edit restores each entry in the snapshot to its saved values.
  2. For each restored entry, the frm_after_update_entry action runs. Form actions set to run when an entry is updated run here too.
  3. The frm_bulk_edit_after_revert_snapshot action runs once, after all entries in the snapshot are done.

The action also runs when some entries can't be restored, for example because they were deleted. In that case, $reverted is lower than the number of entries in the snapshot. It can be 0.

When no entries are restored, the Bulk Edit screen shows Revert failed., but the action has already run.

The action doesn't run when the snapshot doesn't exist, or when another bulk update is still saving entries in the same form.

The snapshot isn't deleted by a revert, so it's still in the database when the action runs.

Usage

add_action( 'frm_bulk_edit_after_revert_snapshot', 'my_function_name', 10, 3 );

Parameters

  • $snapshot_id (int): The ID of the snapshot that was reverted.
  • $requesting_user_id (int): The ID of the WordPress user who clicked Revert.
  • $reverted (int): The number of entries that were restored.

Examples

Learn where to put the code when adding a custom PHP function to your site.

Email the site admin after a revert

This example sends an email to the site's admin email address each time someone reverts a snapshot. The email says who reverted it and how many entries were restored.

add_action( 'frm_bulk_edit_after_revert_snapshot', 'my_frm_bulk_edit_revert_email', 10, 3 );
function my_frm_bulk_edit_revert_email( $snapshot_id, $requesting_user_id, $reverted ) {
	$user = get_userdata( $requesting_user_id );
	$name = $user ? $user->display_name : 'Unknown user';

	$subject = sprintf( 'Bulk Edit snapshot %d was reverted', $snapshot_id );
	$message = sprintf( '%s reverted Bulk Edit snapshot %d. Entries restored: %d.', $name, $snapshot_id, $reverted );

	wp_mail( get_option( 'admin_email' ), $subject, $message );
}

Replace get_option( 'admin_email' ) with another email address to send the email to someone else.

Log a revert that restored no entries

This example writes a line to the PHP error log when a revert restores no entries. For example, the entries in the snapshot may have been deleted.

add_action( 'frm_bulk_edit_after_revert_snapshot', 'my_frm_bulk_edit_log_empty_revert', 10, 3 );
function my_frm_bulk_edit_log_empty_revert( $snapshot_id, $requesting_user_id, $reverted ) {
	if ( 0 === $reverted ) {
		error_log( sprintf( 'Bulk Edit: snapshot %d was reverted by user %d, but no entries were restored.', $snapshot_id, $requesting_user_id ) );
	}
}

Where the line is written depends on your server. On many sites, set both WP_DEBUG and WP_DEBUG_LOG to true in wp-config.php to write it to wp-content/debug.log. WP_DEBUG_LOG alone writes nothing. Learn more in the WordPress debugging documentation.

  • Run code each time an entry is updated, including each entry a Bulk Edit save or revert changes, with the frm_after_update_entry hook.
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 © 2026 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms