Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GravityView Entry Revisions - Modify Ignored Fields
<?php
/**
* 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 );
@marklamb20

This comment has been minimized.

Copy link

@marklamb20 marklamb20 commented Nov 30, 2020

Hey sir, i tried your snippet but it didn't work for me in the frontend.

I change my form id and field id but it did not do anything. Can you please confirm if it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment