Last active
December 15, 2021 15:26
-
-
Save zackkatz/2750a6c2cfa034580c0e3cf519f4c8bf to your computer and use it in GitHub Desktop.
GravityView Entry Revisions - Modify Ignored Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Same here on frontend, using ID of fields doesn't seems to work.
Thanks @tazeverywhere; the next update will fix the issue where int
or float
are required.
Thanks to you @zackkatz , very useful plugin! Using it with gravity-flow is a must.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?