(Advanced) How to modify what fields are shown in GravityRevisions

You may want to exclude specific fields from appearing in GravityRevisions notifications. For example, suppose the following:

For example, if you have fields that get updated but that the user should not see since they are private and meant only for administrators, you would not want those values appearing in your notification emails when using the {entry_revision_diff} Merge Tag.

 * Modify the fields shown for entry revisions for Form #17
 * @param array $ignored_keys Array of entry meta keys and field IDs to not display in the diff, for example [ 'id', 'date_updated', '1.2' ].
 * @param array $form Gravity Forms form array.
 * @returns array $ignored_keys with added fields to ignore.
add_filter( 'gravityview/entry-revisions/diff-ignored-keys', function( $ignored_keys, $form ) {

	if ( empty( $form ) ) {
		return $ignored_keys;
    	// Only run this filter for Form #17
    	if ( 17 !== (int) $form['id'] ) {
		return $ignored_keys;	
	$ignored_keys[] = '1'; // Don't show Field #1
	$ignored_keys[] = '2.2'; // Don't show the second input on field #2
	return $ignored_keys;
}, 10, 2 );

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us